Multiple Display Files in One Program
March 7, 2007 G'Day, Ted
I have a client that has many old apps running in the S/36 Execution Environment. I had converted one of the inquiry programs into an ILE RPG program, keeping the program-described workstation definition, so that I could easily call this program from other programs. After some time, it was decided that we needed to display some information in a subfile-like format from this program. Not wanting to go through all the hassle of defining all the input and output specifications, I tried something, and to my surprise, it worked.
I created a second workstation file containing just the subfile record and subfile control formats and added the second workstation file to the program without any problems! In fact, what happens is that the top section of the screen is output through the original workstation file and then the subfile overlays this screen. Using this technique has saved my client the expense of paying me to convert all the screens in the original program to external definitions and yet allows me to give them subfiles.
Steve is one of Four Hundred Guru‘s Australian readers. I’m always glad to hear from him, as his comments and perspective are interesting.
Until Steve brought this experience to my attention, I had no idea that one module could have more than one workstation file. I created a short test program and was amazed to see it work. Truly, I learn something new every day.
Here’s the first display file, QAD1282D1.
A DSPSIZ(24 80 *DS3) A R SCREEN1 A 5 8'This is screen 1.' A 7 8'Enter your name:' A NAME 10 I 7 26
And here’s the second display file, QAD1282D2.
A DSPSIZ(24 80 *DS3) A R SCREEN2 A OVERLAY A 10 8'This is screen 2.' A 12 8'Enter your age:' A AGE 3 0I 12 26 A R DUMMY A KEEP ASSUME A 1 2' '
And here’s RPG program QAD1282R, which drives them.
FQAD1282D1 CF F 80 WORKSTN FQAD1282D2 CF E WORKSTN IQAD1282D1 NS I 1 10 SNAME C CLEAR SNAME C CLEAR AGE C MOVE *ON *INLR C EXCEPT S1 C READ QAD1282D1 C EXFMT SCREEN2 C RETURN OQAD1282D1 E S1 O K8 'SCREEN1 '
When I call the RPG program, I am prompted for my name. After pressing Enter, I am prompted for my age. Both screens are visible at the same time.
Let me point out a few items of note.
Many thanks to Steve for bringing this technique to my attention.