×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: COBOL
Posted by: rpgers legacy
Added: Oct 7, 2011 5:09 PM
Views: 1028
Tags: rpg
  1.   * RPG IV no longer requires the use of the *INLR indicator to terminate a program.
  2.      * by using the MAIN keyword on the "H" (Header) spec, and identifying the "main"or
  3.      * entry procedure name, the program will begin and end normally without using the
  4.      * decades-old RPG Cycle and instead a more "C like" begin and end logic.
  5.      H  MAIN('GETCUSTINF')
  6.      * "D" specs are used to define variables and parameters
  7.      * The "prototype" for the program is in a separate file
  8.      * allowing other programs to call it
  9.       /copy cust_pr
  10.      * The "procedure interface" describes the *ENTRY parameters
  11.      D getCustInf      PI
  12.      D  pCusNo                        6p 0   const
  13.      D  pName                        30a
  14.      D  pAddr1                       30a
  15.      D  pAddr2                       30a
  16.      D  pCity                        25a
  17.      D  pState                        2a
  18.      D  pZip                         10a
  19.       /free
  20.         exec sql select arName, arAddr1, arAdd2, arCity, arStte, arZip
  21.                  into  :pName, :pAddr1, :pAddr2, :pCity, :pState, :pZip
  22.                  from   ARMstF1
  23.                  where  arCNum = :pCusNo
  24.                  for fetch only
  25.                  fetch first 1 row only
  26.                  optimize for 1 row
  27.                  with CS;
  28.       /end-free
  29.