Loop in the CL from tn5250j AS400

Robby Danneels
Robby Danneels used Ask the Experts™
on
Hi Guys,
I have a problem how to make a sqaure and triangle with a for loop.
when i say it have to need 6 lines then the square has the look like this
000000
0 .......0  
0........0
0........0
0........0
000000

for a triangle it has the look like this

..........0.........
........000......
......00000...
....0000000.
.000000000
0000000000
something like that and dont know how to start
hopefully you guys can help

cheers Robby and sorry for my bad englisch
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Gary PattersonVP Technology / Senior Consultant

Commented:
In a green-screen (TN5250) environment, you would typically use Screen Design Aid (SDA) to create a display file (*DSPF).  Here is a tutorial that explains how to create a display file.  You can just use literals to draw your shapes.

http://www.go4as400.com/chapterload.aspx?cid=26

Here is a simple CL that will display a record format called SCREEN1 in a display file MYDSPF:

pgm
   dclf file(MYDSPF) rcdfmt(SCREEN1)
   sndrcvf
endpgm

Author

Commented:
Dear Gary,

Thanks for your information, but i have to write everything in code.
Frits i have to write how many lines do you need in the figure betweter (2-10)
Then you have to choose between à square or a triangel
Them at last if you have choose a number between 2 and 10 and you have choose witch figure you want
Them my output have become like my first command

Greets Robby
VP Technology / Senior Consultant
Commented:
Then you could create a display file with variables for each line, and in your program you would write code to fill in each line the way you want.

DSPF would contain variables like this:

0000.40      A          R SCREEN1                    
0000.60      A            LINE1          6   O  2  2
0001.00      A            LINE2          6   O  3  2
0002.00      A            LINE3          6   O  4  2
0003.00      A            LINE4          6   O  5  2
0004.00      A            LINE5          6   O  6  2
0005.00      A            LINE6          6   O  7  2

Then In your CL program, you could assign the correct value to each line, and then SNDRCFV

CHGVAR &LINE1 VALUE('000000')
CHGVAR &LINE2 VALUE('0     0')
...
SNDRCVF

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial