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
 

 

want to move a comp-3 into a file. Please help

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

New User


Joined: 17 Feb 2011
Posts: 12
Location: chennai

PostPosted: Sat Feb 26, 2011 1:10 am    Post subject: want to move a comp-3 into a file. Please help
Reply with quote

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
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Feb 26, 2011 1:50 am    Post subject:
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Feb 26, 2011 1:53 am    Post subject: Re: want to move a comp-3 into a file. Please help
Reply with quote

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
View user's profile Send private message
abhikulsh
Currently Banned

New User


Joined: 17 Feb 2011
Posts: 12
Location: chennai

PostPosted: Sat Feb 26, 2011 1:57 am    Post subject: Reply: it will accept
Reply with quote

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
View user's profile Send private message
abhikulsh
Currently Banned

New User


Joined: 17 Feb 2011
Posts: 12
Location: chennai

PostPosted: Sat Feb 26, 2011 2:02 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Feb 26, 2011 2:17 am    Post subject:
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Sat Feb 26, 2011 2:18 am    Post subject:
Reply with quote

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
View user's profile Send private message
abhikulsh
Currently Banned

New User


Joined: 17 Feb 2011
Posts: 12
Location: chennai

PostPosted: Sat Feb 26, 2011 2:51 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Feb 26, 2011 2:55 am    Post subject: Reply to: want to move a comp-3 into a file. Please help
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Sat Feb 26, 2011 3:01 am    Post subject:
Reply with quote

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 icon_evil.gif

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
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 How to move a long alphanumeric data ... lind sh COBOL Programming 6 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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