Linkage Section in Main Program


Use the following root program to pass the command line and its length to your main program:

 identification division.
 program-id.     root.
 environment division.
 configuration section.
 source-computer. cobol2.
 working-storage section.
 01  main-linkage.
     03  cmd-length                  pic 9(4) binary value 0.
     03  cmd-line                    pic x(100).
 procedure division.
 accept cmd-line from command-line.
 if cmd-line not = spaces
     inspect cmd-line tallying cmd-length for
     characters before initial space
 call "main" using main-linkage.
 exit program.