IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

COBOL pgm not getting the correct values from JCL parm


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rakesh17684

New User


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

PostPosted: Wed Feb 18, 2009 2:14 pm
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
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: 61
Location: San Diego

PostPosted: Wed Feb 18, 2009 2:50 pm
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
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: 61
Location: San Diego

PostPosted: Wed Feb 18, 2009 3:16 pm
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
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: 61
Location: San Diego

PostPosted: Wed Feb 18, 2009 3:56 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top