Working with RPG screen manager
Automatically manage the different screens and routines of an interactive program.
Abstract
Continue Reading This Article
Enjoy this article as well as all of our content, including E-Guides, news, tips and more.
The goal of this procedure is to automatically manage the different screens and routines of an interactive program, leaving in the programmer's hands the screen design and the validations and process routines code only.
With this procedure, it's assumed the program is made up of (np) screens and that each has three process associated: write/read (prc = 'S'); error handling (prc = 'V') and process itself (prc= 'P'). It also assumes F3 means "out of the program" and F12 means "one screen back."
Implementation
Copy the scrntmplc with the name of the program you want to create . i.e.:
Pgmtest
Define the files and workstation on the f specifications Update the routines si, vi, and xi (For i <= np)
Create the program
CRTRPGPGM PGMTEST SRCFILE(mylib/myfile)
Run the program
CALL PGMTEST 'np'
NOTES:
With this procedure, it's also assumed that: *in99 = error; *in03 = out and *in12 = screen back
*** scrncopy *** dpointer s * inz(%addr(*in)) dindicator ds 100 based(pointer) d out 3 3n d back 12 12n d error 99 99n dpa s 2S 0 dnp s 2S 0 dprc s 1a * C *entry plist C parm npalfa 2 C move npalfa np C eval indicator = *all'0' C eval pa = 0 C eval prc = 'P' * C dow not out and not (back and pa = 1) b1 * C exsr scrnmngr * C select C when pa = 1 and prc = 'S' C exsr s1 C when pa = 1 and prc = 'V' C exsr v1 C when pa = 1 and prc = 'P' C exsr x1 C when pa = 2 and prc = 'S' C exsr s2 C when pa = 2 and prc = 'V' C exsr v2 C when pa = 2 and prc = 'P' C exsr x2 C when pa = 3 and prc = 'S' C exsr s3 C when pa = 3 and prc = 'V' C exsr v3 C when pa = 3 and prc = 'P' C exsr x3 C when pa = 4 and prc = 'S' C exsr s4 C when pa = 4 and prc = 'V' C exsr v4 C when pa = 4 and prc = 'P' C exsr x4 C when pa = 5 and prc = 'S' C exsr s5 C when pa = 5 and prc = 'V' C exsr v5 C when pa = 5 and prc = 'P' C exsr x5 C when pa = 6 and prc = 'S' C exsr s6 C when pa = 6 and prc = 'V' C exsr v6 C when pa = 6 and prc = 'P' C exsr x6 C when pa = 7 and prc = 'S' C exsr s7 C when pa = 7 and prc = 'V' C exsr v7 C when pa = 7 and prc = 'P' C exsr x7 C when pa = 8 and prc = 'S' C exsr s8 C when pa = 8 and prc = 'V' C exsr v8 C when pa = 8 and prc = 'P' C exsr x8 C when pa = 9 and prc = 'S' C exsr s9 C when pa = 9 and prc = 'V' C exsr v9 C when pa = 9 and prc = 'P' C exsr x9 C when pa = 10 and prc = 'S' C exsr s10 C when pa = 10 and prc = 'V' C exsr v10 C when pa = 10 and prc = 'P' C exsr x10 C endsl * C eval out = *in03 C eval back = *in12 C eval error = *in99 * C enddo e1 C seton lr * C scrnmngr begsr C select C when prc = 'S' C if back C if pa > 1 C eval pa = pa - 1 C endif C else C eval prc = 'V' C endif C when prc = 'V' C if not error C eval prc = 'P' C else C eval prc = 'S' C endif C when prc = 'P' C eval prc = 'S' C if pa < np C eval pa = pa + 1 C else C eval pa = 1 C endif C endsl C endsr ---------------------------- *** scrntmpltc *** F** screen ** F** files ** /copy qrpglesrc,scrncopy * C s1 begsr C** exfmt 1st screen C endsr * C s2 begsr C** exfmt 2nd screen C endsr * C s3 begsr C** exfmt 3rd screen C endsr * C s4 begsr C** exfmt 4th screen C endsr * C s5 begsr C** exfmt 5th screen C endsr * C s6 begsr C** exfmt 6th screen C endsr * C s7 begsr C** exfmt 7th screen C endsr * C s8 begsr C** exfmt 8th screen C endsr * C s9 begsr C** exfmt 9th screen C endsr * C s10 begsr C** exfmt 10th screen C endsr * C v1 begsr * validation of the 1st screen C endsr * C v2 begsr * validation of the 2nd screen C endsr * C v3 begsr * validation of the 3rd screen C endsr * C v4 begsr * validation of the 4th screen C endsr * C v5 begsr * validation of the 5th screen C endsr * C v6 begsr * validation of the 6th screen C endsr * C v7 begsr * validation of the 7th screen C endsr * C v8 begsr * validation of the 8th screen C endsr * C v9 begsr * validation of the 9th screen C endsr * C v10 begsr * validation of the 10th screen C endsr * C x1 begsr * process of the 1st screen C endsr * C x2 begsr * process of the 2nd screen C endsr * C x3 begsr * process of the 3rd screen C endsr * C x4 begsr * process of the 4th screen C endsr * C x5 begsr * process of the 5th screen C endsr * C x6 begsr * process of the 6th screen C endsr * C x7 begsr * process of the 7th screen C endsr * C x8 begsr * process of the 8th screen C endsr * C x9 begsr * process of the 9th screen C endsr * C x10 begsr * process of the 10th screen C endsr
Start the conversation
0 comments