How to ACCEPT Numeric value from JCL to Cobol



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

How to ACCEPT Numeric value from JCL to Cobol

Postby charungandhi » Thu Feb 09, 2012 7:53 am

Hi All,

I have to send a X digit (less than or equal to 8 digits) number from JCL to Cobol Program through SYSIN Statement.
But the COBOL program is receiving spaces in the trailing part

Below is the details.

COBOL PROGRAM VARIABLE DECLARATION in Working Storage Section:
000078 * VARIABLE TO ACCEPT DATA (IMEI RANGE AND QUANTITY ) FROM JCL
000079 01 WR-CPN-GROUP.
000080 05 WR-CPN-NUMBER PIC 9(8) VALUE ZEROES.
000081 05 FILLER PIC X(10) VALUE SPACES.
000082 05 WR-CPN-QUANTITY PIC 9(3) VALUE ZEROES.

The Values are accepted in Cobol program using the below accept statement:
ACCEPT WR-CPN-NUMBER
ACCEPT WR-CPN-QUANTITY


the Display staement used in COBOL to display the data received
DISPLAY WR-CPN-NUMBER

Values are passed from JCL Using JCL SYSIN Statement:
//SYSIN DD *
22291
006
/*

Output after running the JCL:
22291bbb (where 'bbb' is spaces)

I want the output to be 00022291. Is there any solution for this. please let me know if extra details are needed.
charungandhi
 
Posts: 1
Joined: Wed Feb 16, 2011 12:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to ACCEPT Numeric value from JCL to Cobol

Postby NicC » Thu Feb 09, 2012 10:50 am

Pass 8 digits e,g, 00022291
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to ACCEPT Numeric value from JCL to Cobol

Postby Nik22Dec » Thu Feb 09, 2012 2:51 pm

Hi,

IMHO, you should see the leading zeroes correctly with the current code. Where exactly have you directed your output to? Sysout?PS File?
Thanks,
Nik
User avatar
Nik22Dec
 
Posts: 68
Joined: Mon Dec 26, 2011 6:38 pm
Has thanked: 2 times
Been thanked: 0 time

Re: How to ACCEPT Numeric value from JCL to Cobol

Postby BillyBoyo » Thu Feb 09, 2012 3:13 pm

charungandhi,

I assume this is an exercise. Normally on a mainframe you won't be using ACCEPT for getting input data. Far better to use a file in the normal way.

You need to check in the manual to discover that ACCEPT is not doing anything clever for you, which means you need to do the clever stuff afterwards. So you have to work out how to turn one to eight left-justified bytes into eight right-justified leading-zero-padded bytes. Read up well in the manual and come back here if you have problems.

Nik22Dec,

You have to check in the manual as well.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post