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
 

 

Copy from alphanumeric to Comp-3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Wed May 19, 2010 1:22 pm    Post subject: Copy from alphanumeric to Comp-3
Reply with quote

Hi ...

How can we copy alphanumeric variable to Comp-3 variable or vice versa??

Please suggest me any correct reference to get more knwoledge on this !!
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed May 19, 2010 3:26 pm    Post subject:
Reply with quote

Have you looked at Valid and invalid elementary moves?
Back to top
View user's profile Send private message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Wed May 19, 2010 4:39 pm    Post subject:
Reply with quote

Thanks for your reply .

The link is very useful . However it doesn't have information about the movement to COMP-3/COMP fields.

Please can you help me with this .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 19, 2010 4:43 pm    Post subject:
Reply with quote

how about 1.6.6.3 Converting to numbers (NUMVAL, NUMVAL-C) in the manual.
Back to top
View user's profile Send private message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Wed May 19, 2010 4:43 pm    Post subject:
Reply with quote

Code:

However it doesn't have information about the movement to COMP-3/COMP fields.


I am looking for COMP-3 movement !

(option-6 in the link have information about COMP)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 19, 2010 4:50 pm    Post subject:
Reply with quote

Quote:
I am looking for COMP-3 movement !


well, you have a link to a manual, as well as the hyperlinks at the top of the page for manuals.

Start looking!!!!
Back to top
View user's profile Send private message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Wed May 19, 2010 6:01 pm    Post subject:
Reply with quote

Thanks for your reply .

I tried to google , I found that ..

We can't really move non-numerical character string into a COMP-3 (packed decimal) field. However compiler doesn't stop .

The difference would be in the end-result .

Does this mean the data resulted will not be accurate ?

Please give me hint for the below .
A PIC X(2)
B PIC 9(2) Comp-3

If I try to move values of variable 'A' , i.e "X " (X and Space) to the variable 'B' , what would be contents of the 'B'?

I think it would be hex of 'X' and Space ..

Please correct me if I am completely incorrect ..
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Wed May 19, 2010 6:10 pm    Post subject:
Reply with quote

Well for crying out loud - try it already and see what happens.

If your terminal starts smoking, though, we never had this conversation.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Wed May 19, 2010 6:11 pm    Post subject:
Reply with quote

Quote:
The link is very useful . However it doesn't have information about the movement to COMP-3/COMP fields.
Actually, the link William Thompson provided tells you exactly this. The second line of the table is alphanumeric sending fields whereas the fourth column is numeric receiving fields -- which is PRECISELY what you want to do. If you check the table, you will find that this is permitted with a footnote. The footnote says
Quote:
3. Figurative constants and alphanumeric literals must consist only of numeric characters and will be treated as
numeric integer fields.
so your example of moving an alphanumeric field of X and space into a COMP-3 variable is not permitted under the rules of COBOL as expressed in the table William pointed you to. If you try this, you'll get some form of run-time error (probably a S0C7 abend but others are possible) -- I haven't tested to find out the exact message generated. But in general, if your variable A has all numeric characters in it, the number will be converted and moved to B just fine.
Back to top
View user's profile Send private message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Wed May 19, 2010 6:19 pm    Post subject:
Reply with quote

Thanks all
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Wed May 19, 2010 7:01 pm    Post subject:
Reply with quote

Actually, the footnote referenced speaks only of FIGURATIVE CONSTANTS ( e.g. 'ZERO' ) and ALPHANUMERIC LITERALS ( e.g. '127' ); it does not refer to alphanumeric data elements ( e.g. 'WS-FIELD-X' ).
However, on the previous page of the manual, the rules are given for the situation in question - namely:

Quote:
When the receiving field is NUMERIC or NUMERIC-EDITED:

When the category of the sending item is alphanumeric, alphanumeric-edited, national, or national-edited, the data is moved as if the sending item were described as an unsigned integer.


What's the difference? And why would I be so nit-picky as to point out the nuance?
Well, because there IS a difference: an alphanumeric LITERAL can contain a sign, e.g. '-444', whereas an alphanumeric sending item cannot - according to the rules, an alphanumeric sending field is treated as though it were an UNSIGNED integer. Not so for an alphanumeric literal.
Back to top
View user's profile Send private message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Wed May 19, 2010 8:47 pm    Post subject:
Reply with quote

bit confused now .. vl read the manuals now ..

Thanks all for your time now
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 1 Fri Dec 02, 2016 9:47 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm


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