From: Jim Oliverie To: All I am currently in the process of migrating to the AS/400 in S/36E. The software made extensive use of external Assembler subroutines. I was wondering if there was something on the AS/400 to do the following.
Read the workstation buffer when roll keys are pressed.
Find the cursor position.
Convert the cursor position (row and column) to decimal values.
From: Douglas Handy To: Jim Oliverie
Regarding workstation read data with roll: with native DDS, you would normally just add a response indicator to the roll or page keywords-e.g., ROLLUP(99) ROLLDOWN(98). But with USRDSPMGT (the DDS keyword for S/36 compatibility), response indicators generate a warning message.
It may be this can be ignored and data will be returned anyway, but then I'm not sure that *STATUS would be updated so you'd have a hard time knowing a roll key was pressed.
Instead of using a SUBRWR equivalent, you could switch to the other method used on the S/36 for roll key data. The S/36E was changed to support it back on Release 1 when people complained the undocumented (by IBM) method didn't work on the AS/400.
It requires using a demand file instead of a primary file. On the first read (say in first-cycle calculations), name an error indicator in columns 56-57. This read cannot return roll data. On subsequent reads, leave out the error indicator in 56-57. The roll data will be returned on these reads. See this month's Tech36 for an example of this code.
About the position of the cursor, this information is now available in the INFDS, even with RPG36. The binary row is in 370, and the binary column is in 371 (3a).
About the position of the cursor, this information is now available in the INFDS, even with RPG36. The binary row is in 370, and the binary column is in 371 (Figure 3a).
Converting to decimal:
Create a small RPG/400 program to achieve the same end. You could continue to use EXIT/RLABL, but then an extraneous array also gets passed with the field sizes. I prefer using CALL/PARM. It is allowed in RPG36 programs. 3b shows the general idea.
Create a small RPG/400 program to achieve the same end. You could continue to use EXIT/RLABL, but then an extraneous array also gets passed with the field sizes. I prefer using CALL/PARM. It is allowed in RPG36 programs. Figure 3b shows the general idea.
A couple of points about the program:
Since RPG36 doesn't allow FREE, I added the third PARM so you could shut it down gracefully from the calling program at LR time. The third parameter should contain '0' until you want the storage freed.
The field sizes are 2 and 5 bytes instead of 1 and 2 bytes to make it more generic. You may prefer a different implementation.
Passing numeric parameters between RPG36 and RPG/400 is a pain since RPG36 defaults to zoned and RPG/400 defaults to packed decimal. One circumvention is to pass it in character form.
TechTalk: S/36 to AS/400 Conversion Tips
Figure 3A Cursor position from INFDS
Figure 3a: Cursor Position From INFDS ....1.... ....2.... ....3.... ....4.... ....5.... ....6.... ....7 IINFDS DS I 370 370 ROW I 371 371 COL
TechTalk: S/36 to AS/400 Conversion Tips
Figure 3B Convert cursor position to decimal
Figure 3b: Convert Cursor Position to Decimal ....1.... ....2.... ....3.... ....4.... ....5.... ....6.... ....7 IDS1 DS I I B 1 20BINARY IDS2 DS I I 1 50ZONED C *ENTRY PLIST C PARM INPUT 1 C PARM OUTPUT 3 C PARM EOJ 1 C* C MOVE INPUT DS1 C Z-ADDBINARY ZONED C MOVE DS2 OUTPUT C* C EOJ IFEQ '1' C SETON LR C END C* C RETRN
LATEST COMMENTS
MC Press Online