File indexing completed on 2025-02-02 03:54:46
0001 <!DOCTYPE html> 0002 <html><head> 0003 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 0004 <title>qrpg.test</title> 0005 <meta name="generator" content="KF5::SyntaxHighlighting - Definition (ILERPG) - Theme (Breeze Dark)"/> 0006 </head><body style="background-color:#232629;color:#cfcfc2"><pre> 0007 <span style="color:#7a7c7d"> * "F" (file) specs define files and other i/o devices</span> 0008 <span style="font-weight:bold">F</span> ARMstF1 IF E K Disk Rename(ARMST:RARMST) 0009 0010 <span style="color:#7a7c7d"> * "D" (data) specs are used to define variables</span> 0011 <span style="font-weight:bold">D</span> pCusNo S <span style="color:#f67400">6</span>p 0012 <span style="font-weight:bold">D</span> pName S <span style="color:#f67400">30</span>a 0013 <span style="font-weight:bold">D</span> pAddr1 S <span style="color:#f67400">30</span>a 0014 0015 <span style="color:#7a7c7d"> * The "chain" command is used for random access of a keyed file</span> 0016 <span style="font-weight:bold">C</span><span style="color:#cc0000"> </span>pCusNo <span style="font-weight:bold">chain</span> ARMstF1 0017 0018 <span style="color:#7a7c7d"> * If a record is found, move fields from the file into parameters</span> 0019 <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> 0020 <span style="font-weight:bold">C</span><span style="color:#cc0000"> </span> <span style="font-weight:bold">eval</span> pName = ARNm01 0021 <span style="font-weight:bold">C</span><span style="color:#cc0000"> </span> <span style="font-weight:bold">eval</span> pAddr1 = ARAd01 0022 <span style="font-weight:bold">C</span><span style="color:#cc0000"> </span> <span style="font-weight:bold">eval</span> pAddr2 = ARAd02 0023 <span style="font-weight:bold">C</span><span style="color:#cc0000"> </span> <span style="font-weight:bold">eval</span> pCity = ARCy01 0024 <span style="font-weight:bold">C</span><span style="color:#cc0000"> </span> <span style="font-weight:bold">endif</span> 0025 0026 <span style="color:#7a7c7d"> * RPG makes use of switches. One switch "LR" originally stood for "last record"</span> 0027 <span style="color:#7a7c7d"> * LR flags the program and its dataspace as removable from memory</span> 0028 0029 <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> 0030 0031 <span style="color:#7a7c7d"> * "F" (file) specs define files and other i/o devices</span> 0032 <span style="font-weight:bold">F</span>ARMstF1 IF E K Disk Rename(ARMST:RARMST) 0033 0034 <span style="color:#7a7c7d"> * "D" (data) specs are used to define variables and parameters</span> 0035 <span style="color:#7a7c7d"> * The "prototype" for the program is in a separate file</span> 0036 <span style="color:#7a7c7d"> * allowing other programs to call it</span> 0037 <span style="color:#27ae60"> /copy</span> cust_pr 0038 <span style="color:#7a7c7d"> * The "procedure interface" describes the *ENTRY parameters</span> 0039 <span style="font-weight:bold">D</span> getCustInf PI 0040 <span style="font-weight:bold">D</span> pCusNo <span style="color:#f67400">6</span>p <span style="color:#f67400">0</span> <span style="font-weight:bold">const</span> 0041 <span style="font-weight:bold">D</span> pName <span style="color:#f67400">30</span>a 0042 <span style="font-weight:bold">D</span> pAddr1 <span style="color:#f67400">30</span>a 0043 <span style="font-weight:bold">D</span> pAddr2 <span style="color:#f67400">30</span>a 0044 <span style="font-weight:bold">D</span> pCity <span style="color:#f67400">25</span>a 0045 <span style="font-weight:bold">D</span> pState <span style="color:#f67400">2</span>a 0046 <span style="font-weight:bold">D</span> pZip <span style="color:#f67400">10</span>a 0047 <span style="color:#27ae60"> /free</span> 0048 <span style="color:#7a7c7d">// The "chain" command is used for random access of a keyed file</span> 0049 <span style="font-weight:bold">chain</span> pCusNo ARMstF1; 0050 0051 <span style="color:#7a7c7d">// If a record is found, move fields from the file into parameters</span> 0052 <span style="font-weight:bold">if</span> <span style="font-weight:bold">%found</span>; 0053 pName = ARNm01; 0054 pAddr1 = ARAd01; 0055 pAddr2 = ARAd02; 0056 pCity = ARCy01; 0057 pState = ARSt01; 0058 pZip = ARZp15; 0059 <span style="font-weight:bold">endif</span>; 0060 0061 <span style="color:#7a7c7d">// RPG makes use of switches. One switch "LR" originally stood for "last record"</span> 0062 <span style="color:#7a7c7d">// LR actually flags the program and its dataspace as removable from memory.</span> 0063 <span style="color:#cc0000">*InLR</span> = <span style="color:#cc2222">*On</span>; 0064 <span style="color:#27ae60"> /end-free</span> 0065 0066 <span style="font-weight:bold">H</span> main(GetCustInf) 0067 <span style="font-weight:bold">D</span> ARMSTF1 E DS 0068 <span style="font-weight:bold">P</span> GetCustInf B 0069 <span style="font-weight:bold">D</span> GetCustInf PI <span style="font-weight:bold">extpgm</span>(<span style="color:#dd0022">'CUS001'</span>) 0070 <span style="font-weight:bold">D</span> inCusNo <span style="font-weight:bold">like</span>(arCNum) <span style="font-weight:bold">const</span> 0071 <span style="font-weight:bold">D</span> outName <span style="font-weight:bold">like</span>(arName) 0072 <span style="font-weight:bold">D</span> outAddr1 <span style="font-weight:bold">like</span>(arAdd1) 0073 <span style="font-weight:bold">D</span> outAddr2 <span style="font-weight:bold">like</span>(arAdd2) 0074 <span style="font-weight:bold">D</span> outCity <span style="font-weight:bold">like</span>(arCity) 0075 <span style="font-weight:bold">D</span> outState <span style="font-weight:bold">like</span>(arStte) 0076 <span style="font-weight:bold">D</span> outZip <span style="font-weight:bold">like</span>(arZip) 0077 <span style="color:#27ae60"> /free</span> 0078 exec sql <span style="font-weight:bold">select</span> arName, arAdd1, arAdd2, arCity, arStte, arZip 0079 into :outName, :outAddr1, :outAddr2, :outCity, :outState, 0080 :outZip 0081 from ARMSTF1 0082 where arCNum = :inCusNo 0083 fetch first <span style="color:#f67400">1</span> row only 0084 with CS 0085 use currently committed; 0086 <span style="color:#27ae60"> /end-free</span> 0087 <span style="font-weight:bold">P</span> GetCustInf E 0088 </pre></body></html>