Usage of PARM in COBOL from JCL



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Usage of PARM in COBOL from JCL

Postby navennaik » Thu Apr 23, 2009 6:38 pm

Hello

I want to use the PARM value passed by the JCL in my COBOL program.

So for the sake of the same i am just looking into some other module where the JCL parameter is as follows.

//STEP1 EXEC PGM=TESTAPP,TIME=5,REGION=6M,
// PARM='090422'

But in my cobol program The coding has been done as below.

LINKAGE SECTION.

01 PARM-INFO.
05 PARM-LENGTH PIC S9(04) COMP.
05 PARM-DATE.
10 PARM-YY PIC X(02).
10 PARM-MM PIC X(02).
10 PARM-DD PIC X(02).

PROCEDURE DIVISION USING PARM-INFO.

So even though the PARM value passed to the program is only 6 charecter long , why have they used the COMP field PARM-LENGTH.

Thanks
Naveen
navennaik
 
Posts: 8
Joined: Thu Feb 26, 2009 7:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Usage of PARM in COBOL from JCL

 

Re: Usage of PARM in COBOL from JCL

Postby swd » Thu Apr 23, 2009 7:04 pm

Naveen
The PARM-LENGTH PIC S9(04) COMP is the length of the parameter passed (which will be 6 in your example), and this length is stored in the PARM-LENGTH field which is defined in the 'standard' and usual way, which is a signed number field. The format of the parm field is the length (S9(4) COMP field) and then the actual parm contents which (I think) can be up to 256 bytes long.

I hope this answers your question.
Cheers
Steve
User avatar
swd
 
Posts: 109
Joined: Wed Feb 18, 2009 9:18 pm
Location: UK
Has thanked: 0 time
Been thanked: 0 time

Re: Usage of PARM in COBOL from JCL

Postby Bill Dennis » Thu Apr 23, 2009 7:30 pm

A parm in JCL has max length of 100.

You might want to test the length indicator to ensure all 6 bytes were supplied in the PARM.
Regards,

Bill Dennis

Disclaimer: My comments on this forum are my own and do not represent the opinions or suggestions of any other person or business entity.
Bill Dennis
 
Posts: 278
Joined: Thu May 15, 2008 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Usage of PARM in COBOL from JCL

Postby dick scherrer » Fri Apr 24, 2009 1:37 am

Hello,

Keep in mind that even if you don't compare the length field for a proper length, you still must allow for the length field (as it is in the posted code).

You also need to check the parm fields to ensure the date entered is valid.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post