Loop in the CL from tn5250j AS400

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
Robby DanneelsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
0
Robby DanneelsAuthor 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
0
Gary PattersonVP 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
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.