|
> From: Simon Coulter
>
> If I have a standard RPG III display file processing loop like:
> <SNIP CODE>
> What will that look like after it has been run through your conversion
> process? That is, what happens to the WRITE and EXFMT statements?
The mainline is very simple:
* Display the screen until user requests exit
B1 C EXIT DOUEQ$YES
* Display the static parts of the screen
RV01dC** WRITEOBJHDR
RV01aC EXSR PSCI01
RV01dC** WRITEOBJOPT
RV01aC EXSR PSCI02
RV01dC** WRITEOBJFKEY
RV01aC EXSR PSCI03
* Display program messages - OS/400 does the hard work
RV01dC** WRITEERRCTL
RV01aC EXSR PSCI04
* If we have object list entries to display
B2 C LSTCNT IFGT *ZERO
* Display the filled SFL and wait for user action
C SETON 9192 SFLDSP
SFLDSPCTL
C EXFMTOBJCTL1 First SFL
C SETOF 9192 SFLDSP
SFLDSPCTL
* . . . otherwise . . .
X2 C ELSE
* Display 'no objects' message
C SETON 92 SFLDSPCTL
RV01dC** WRITEOBJCTL1 First SFL
RV01aC EXSR PSCI05
RV01dC** EXFMTOBJNUN No objects
RV01aC EXSR PSCI06
C SETOF 92 SFLDSPCTL
E2 C END LSTCNT > *ZERO
*
E1 C END EXIT U= $YES
As you can see, each I/O opcode is replaced with a subroutine. This way,
your mainline stays pretty much intact. I think the above code is pretty
readable, especially since the original I/O statements are left in place as
comments. The subroutine looks something like this:
PSC aC PSCI01 BEGSR
PSC aC PSCTYP IFEQ '1'
PSC aC WRITEOBJHDR
PSC aC ELSE
PSC aC EXSR PSCW01
PSC aC CALL 'PSCBAPI2'
PSC aC PARM PSCN01 PSCRCD 10
PSC aC PARM 'WRITE' PSCOPC 5
PSC aC *IN PARM *IN PSCIND
PSC aC PARM PSCD01
PSC aC ENDIF
PSC aC ENDSR
If we're in interactive mode, the PSCTYP field is a '1', and the original
statement is executed. Otherwise, a call is made to the PSC400 API program,
passing the appropriate parameters. (Note that if the same I/O opcode
appears more than once, it's replaced by a call to the same subroutine.)
You might start wondering about a few things like "What is PSCW01"? PSCW01
is a subroutine that moves data from screen fields into the PSCD01 data
structure. Or "What is PSCN01"? It's a constant containing the ID for the
OBJHDR record format. Or "How do the command keys and the INFDS get set"?
That depends on the I/O opcode. EXFMT will set the command keys, as will a
READ. The INFDS is only set if there is one defined in the program. And so
on. Once you start getting to that level of detail, you really need to see
an assessment of the product working with your code. I hope that this is
enough to give you a general idea of how the tool works.
Joe
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.