Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

COBOL pgm not getting the correct values from JCL parm

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
rakesh17684

New User


Joined: 08 Oct 2006
Posts: 60
Location: San Diego

PostPosted: Wed Feb 18, 2009 2:14 pm    Post subject: COBOL pgm not getting the correct values from JCL parm
Reply with quote

Hi,

I have a COBOL program which gets 11 different values as a PARM from a JCL.

Code:

//STEP01  EXEC PGM=PROG1,PARM=('2009-01-21','1234','0012','1111', 
//             '2009-01-22','4321','32767','2222','TABLE_NAME','47',   
//             '999.88')     
                                       


and in PROG1 after receiving the parms via the linkage section i unstring the parms to get individual values into variables.

Code:
UNSTRING WS-EXEC-PRM-VALUE
   DELIMITED BY  ','
   INTO DATE
           SEQ-NO
           FILE-NO
              .
              .
              .
              .
              .
              .
              .
        AMOUNT
END-UNSTRING
.

The problem is the last field (amount) which is declared as
Code:
05 AMOUNT          PIC 9(8)V9(2).

I am not getting the value passed. i get 7 spaces followed by 3 zeroes (for 999.88).
here is the display part of all the parms
Code:
     
2009-01-21     
000000000001234
00012         
01111         
2009-01-22     
000000000004321
32767         
02222         
TABLE_NAME     
00047         
       000   ---this one should be 999.88 


can you guys help me point out where i am going wrong ??
Thanks in advance
Back to top
View user's profile Send private message

aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Wed Feb 18, 2009 2:25 pm    Post subject:
Reply with quote

Hi Rakesh,

Here you are passing Amount as alphanumeric (character string) so you receiving the amount in cobol program in alphanumeric form and then move it to numeric. This could help you.
Back to top
View user's profile Send private message
rakesh17684

New User


Joined: 08 Oct 2006
Posts: 60
Location: San Diego

PostPosted: Wed Feb 18, 2009 2:50 pm    Post subject:
Reply with quote

Quote:
you receiving the amount in cobol program in alphanumeric form


unstring is done into AMOUNT which is declared as
Code:
05 AMOUNT          PIC 9(8)V9(2).
Back to top
View user's profile Send private message
aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Wed Feb 18, 2009 2:53 pm    Post subject:
Reply with quote

Please declare the AMOUNT as follows:-

05 AMOUNT PIC 9(10).

after that you can move it into another variable which is declared as 9(8)v9(2).
Back to top
View user's profile Send private message
rakesh17684

New User


Joined: 08 Oct 2006
Posts: 60
Location: San Diego

PostPosted: Wed Feb 18, 2009 3:16 pm    Post subject:
Reply with quote

yes i did that, but the result was
Code:
PARMS ARE:   0000000000

I am gonna try reference modification for this particular variable. let me see how it comes out.
Back to top
View user's profile Send private message
aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Wed Feb 18, 2009 3:19 pm    Post subject:
Reply with quote

There are 2 options which you can try:-

1. Either pass value of Amount from JCL without quotes i.e. ..'47',998.88)

2. Or you recieve it in X(10) in the program.
Back to top
View user's profile Send private message
rakesh17684

New User


Joined: 08 Oct 2006
Posts: 60
Location: San Diego

PostPosted: Wed Feb 18, 2009 3:56 pm    Post subject:
Reply with quote

Quote:
1. Either pass value of Amount from JCL without quotes i.e. ..'47',998.88)

this gives me a JCL error for decimal values,

Quote:
2. Or you recieve it in X(10) in the program.


This worked fine but then i need to type cast to decimal values. for this i used NUMVAL function and now i am good to go.

Thanks for helping me out. Much appreciated

[/quote]
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts Is the explanation correct? XRST,CHKP Martylin IMS DB/DC 1 Wed Mar 15, 2017 9:26 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us