Page 1 of 1

Linkage Section Usage

PostPosted: Wed Jan 18, 2012 4:19 pm
by balaji_07ece
How to Code the Linkage Section of a Cobol program ??

I want to write a new Cobol program which Should run Daily, Weekly and Monthly using the Proc as and when required. I know it is posiible, if we efficiently use the Linkage Section. But I don't know how to use the Linkage Section efficiently in such a way.

Can Someone explain me how to Code the Linkage section in the Cobol Program for the above mentioned Criteria ??

Re: Linkage Section Usage

PostPosted: Wed Jan 18, 2012 4:41 pm
by BillyBoyo
Are you saying your program will be executed from a PROC which will supply a PARM to your program to indicate the type of run?

Re: Linkage Section Usage

PostPosted: Wed Jan 18, 2012 5:17 pm
by Robert Sample
The first issue is that I don't think "efficiently" means what you think it means. From http://www.thefreedictionary.com
ef·fi·cient (-fshnt)
adj.
1. Acting directly to produce an effect: an efficient cause. See Synonyms at effective.
2.
a. Acting or producing effectively with a minimum of waste, expense, or unnecessary effort.
b. Exhibiting a high ratio of output to input.
Since a LINKAGE SECTION merely describes a memory area being passed from another program, why would you think you need to minimize waste, expense, or unnecessary effort (1 and 2b of the definition don't apply in this case)?

The second issue is that the ONLY way you code a LINKAGE SECTION is to define the data being passed to the program -- period. There may be external restrictions (i.e., if you're passing a parameter from JCL you're limited to 100 characters) but you should not be concerned with anything except how the data fields are defined in the LINKAGE SECTION.

Re: Linkage Section Usage

PostPosted: Wed Jan 18, 2012 6:26 pm
by balaji_07ece
Hi BillyBoyo,

Yes, You are correct my program will be executed by a PROC which will supply a PARM to indicate the type of run.

Now I want to know how to code the LINKAGE SECTION...

Re: Linkage Section Usage

PostPosted: Wed Jan 18, 2012 6:33 pm
by BillyBoyo
LINKAGE SECTION.                                         
01  PARM-FROM-JCL.                                                         
    05 PFJ-LENGTH            PIC S9(04) COMP.                             
    05 PFJ-VALUE.
       10 FILLER OCCURS 0 TO 100 TIMES
             DEPENDING ON PFJ-LENGTH.
          15  FILLER   PIC X.
PROCEDURE DIVISION USING PARM-FROM-JCL.               


Validate the PFJ-LENGTH against the possible lengths you are expecting.

MOVE PFJ-VALUE to use that value specified in the PARM.