View previous topic :: View next topic
|
Author |
Message |
abhikulsh Currently Banned New User
Joined: 17 Feb 2011 Posts: 12 Location: chennai
|
|
|
|
I want to accept a variable using sysin in JCL to my cobol program .
that variable has to be a COMP-3 variable , since this variable replaces the same comp-3 in a file.
But ACCEPT statement in Cobol doesnt take comp-3.
Kindly advice.
//SYSIN DD *
12.2
/*
in Cobol
how do i move value so that it is in comp-3 . |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
ACCEPT the value as pic x(whatever) and then convert it to packed-decimal (comp-3) in the code. Read in the COBOL Language Reference about NUMVAL (link to IBM Manuals at the top of the page).
It is rarely acceptable to make data modifications this way. . . Suggest you get specific direction from management before making this uncontrolled/unaudited change to some Production data. . .
Some organizations terminate people for doing such as this. . . |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
abhikulsh wrote: |
I want to accept a variable using sysin in JCL to my cobol program .
that variable has to be a COMP-3 variable , since this variable replaces the same comp-3 in a file.
But ACCEPT statement in Cobol doesnt take comp-3.
Kindly advice.
//SYSIN DD *
12.2
/*
in Cobol
how do i move value so that it is in comp-3 . |
Yes it will accept a comp-3 value but I don't think you need to know how. Just accept into a numeric display field and then move it to a comp-3 field, that was very difficult to figure out. |
|
Back to top |
|
|
abhikulsh Currently Banned New User
Joined: 17 Feb 2011 Posts: 12 Location: chennai
|
|
|
|
No its not accepting as Comp-3 variabe it says
Identifier "R (PACKED NON-INTEGER)" was used in an
"ACCEPT" statement. The statement was discarded. |
|
Back to top |
|
|
abhikulsh Currently Banned New User
Joined: 17 Feb 2011 Posts: 12 Location: chennai
|
|
|
|
I am accepting in 77 N PIC 9(3)V9(8).
field and thn moving to 77 R PIC 9(03)V9(8) COMP-3
ACCEPT N.
MOVE N TO R.
when i process this R as
MOVE R TO FUND-NAV-PER-SHARE(2)
Here FUND-NAV-PER-SHARE(2) is of PIC 9(03)V9(8) COMP-3.
it gives invalid in file |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
There are multiple ways to do this. . .
Suggest you re-read my first reply and try that. Yes, it does mean that you need to look in the manual - something you should do often. . . |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
abhikulsh wrote: |
I am accepting in 77 N PIC 9(3)V9(8).
field and thn moving to 77 R PIC 9(03)V9(8) COMP-3
ACCEPT N.
MOVE N TO R.
when i process this R as
MOVE R TO FUND-NAV-PER-SHARE(2)
Here FUND-NAV-PER-SHARE(2) is of PIC 9(03)V9(8) COMP-3.
it gives invalid in file |
Have you tried declaring N as PIC 9(3).9(8) instead of PIC 9(3)V9(8)? |
|
Back to top |
|
|
abhikulsh Currently Banned New User
Joined: 17 Feb 2011 Posts: 12 Location: chennai
|
|
|
|
ya tried declaring N as PIC 9(3).9(8) instead of PIC 9(3)V9(8) , it doent work
gives INVALID in file |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Persistent can be a good thing. . . Obstinate is not. . .
Now, maybe you will use the solution that i believe will be easiest for you to accomplish. . .
You have dragged a rather trivial requirement into a many-post topic . . .
d |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
abhikulsh wrote: |
ya tried declaring N as PIC 9(3).9(8) instead of PIC 9(3)V9(8) , it doent work
gives INVALID in file |
I see that my statement was a bit too subtle for you.
Your data is "12.2". Why in the name of the Holy One (blessed be He) would you expect those data to be randomly stuffable into a PIC 9(3)V9(8) -- or PIC 9(3).9(8) -- variable? You don't have the same number of digits, before or after the decimal point, nor are the data aligned properly
Make your data match the variable, or the variable match your data. Or ACCEPT it into PIC X(80) and then write logic to parse it and move it to a COMP-3 variable as Mr. Scherrer has suggested. |
|
Back to top |
|
|
|