1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
* "F" (file) specs define files and other i/o devices
F ARMstF1 IF E K Disk Rename(ARMST:RARMST)
* "D" (data) specs are used to define variables
D pCusNo S 6p
D pName S 30a
D pAddr1 S 30a
* The "chain" command is used for random access of a keyed file
C pCusNo chain ARMstF1
* If a record is found, move fields from the file into parameters
C if %found
C eval pName = ARNm01
C eval pAddr1 = ARAd01
C eval pAddr2 = ARAd02
C eval pCity = ARCy01
C endif
* RPG makes use of switches. One switch "LR" originally stood for "last record"
* LR flags the program and its dataspace as removable from memory
C eval *InLR = *On
* "F" (file) specs define files and other i/o devices
FARMstF1 IF E K Disk Rename(ARMST:RARMST)
* "D" (data) specs are used to define variables and parameters
* The "prototype" for the program is in a separate file
* allowing other programs to call it
/copy cust_pr
* The "procedure interface" describes the *ENTRY parameters
D getCustInf PI
D pCusNo 6p 0 const
D pName 30a
D pAddr1 30a
D pAddr2 30a
D pCity 25a
D pState 2a
D pZip 10a
/free
// The "chain" command is used for random access of a keyed file
chain pCusNo ARMstF1;
// If a record is found, move fields from the file into parameters
if %found;
pName = ARNm01;
pAddr1 = ARAd01;
pAddr2 = ARAd02;
pCity = ARCy01;
pState = ARSt01;
pZip = ARZp15;
endif;
// RPG makes use of switches. One switch "LR" originally stood for "last record"
// LR actually flags the program and its dataspace as removable from memory.
*InLR = *On;
/end-free
H main(GetCustInf)
D ARMSTF1 E DS
P GetCustInf B
D GetCustInf PI extpgm('CUS001')
D inCusNo like(arCNum) const
D outName like(arName)
D outAddr1 like(arAdd1)
D outAddr2 like(arAdd2)
D outCity like(arCity)
D outState like(arStte)
D outZip like(arZip)
/free
exec sql select arName, arAdd1, arAdd2, arCity, arStte, arZip
into :outName, :outAddr1, :outAddr2, :outCity, :outState,
:outZip
from ARMSTF1
where arCNum = :inCusNo
fetch first 1 row only
with CS
use currently committed;
/end-free
P GetCustInf E
|