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