Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
[Solved]Nonumeric movement to the numeric field

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

New User


Joined: 17 Mar 2005
Posts: 2
Location: bangalore

PostPosted: Thu Mar 17, 2005 8:10 pm    Post subject: Nonumeric movement to the numeric field
Reply with quote

What will happen if Nonumeric value is moved to a numeric field?
Compile error.
Runtime error.
Normal execution.
Back to top
View user's profile Send private message

mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1207
Location: India

PostPosted: Thu Mar 17, 2005 11:14 pm    Post subject:
Reply with quote

Quote:
Nonumeric value is moved to a numeric field


Normal execution.

If it's not an Interview Question, then:

You can Move a NonNumeric Value to a Numeric Item, only if the Nonnumeric value is stored as AlphaNumeric variable(X).

X TO 9 is possible, but you can not move A to 9.
Back to top
View user's profile Send private message
ragin

New User


Joined: 20 Feb 2005
Posts: 16

PostPosted: Fri Mar 18, 2005 8:17 am    Post subject: Hey there
Reply with quote

Hey dude,

This is an interview question commonly asked in i-flex.It depends on the value u move to the numeric field.
For Eg:

01 A PIC X(5) Value HI
01 B PIC 9(5)
MOVE A TO B.

Gives u Soc7 Error,since ur moving alphabets to numeric field.Now:

01 A PIC X(5) Value "12345"
01 B PIC 9(5)
MOVE A TO B.
Gives u the exact answer,since ur moving numerals to numerals.Got it dude????
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1207
Location: India

PostPosted: Fri Mar 18, 2005 12:58 pm    Post subject:
Reply with quote

No, you can Move Alphabetic data to Numeric, if the LValue is stored in Alphanumeric DataType (X).

See this sample Program.

Code:
EDIT       IBMMF.EXPERT.FORUM(SAMPLE) - 01.36              Columns 00001 00072
Command ===>                                                  Scroll ===> 005 
****** ***************************** Top of Data ******************************
000100        ID DIVISION.                                                     
000200        PROGRAM-ID. SAMPLE.                                             
000300        DATA DIVISION.                                                   
000310        WORKING-STORAGE SECTION.                                         
000320        01 A PIC X(2) VALUE "AB".                                       
000321        01 B PIC 99.                                                     
000330        PROCEDURE DIVISION.                                             
000600        PRA1.                                                           
000700            MOVE A TO B.                                                 
000701            DISPLAY "VALUE IS" B.                                       
000704            STOP RUN.                                                   
****** **************************** Bottom of Data ****************************


The output is:

Code:
********************************* TOP OF DATA **********************************
VALUE ISA2                                                                     
******************************** BOTTOM OF DATA ********************************


Quote:
01 A PIC X(5) Value HI
01 B PIC 9(5)
MOVE A TO B.

Gives u Soc7 Error,since ur moving alphabets to numeric field.Now:


Moving alphabets to numeric field at compile time will not give S0C7.

Code:
01 A PIC X(5) Value HI
01 B PIC 9(5)
MOVE A TO B.


You will get Compiler Error as:

Code:
IGYGR0145-S   "HI" was not defined as a "SYMBOLIC CHARACTERS" figurative constant.  "HI" was discarded.

IGYGR1080-S   A "VALUE" clause literal was not compatible with the data category of the subject data item.  The "VALUE"  clause was discarded.
                                                   
Back to top
View user's profile Send private message
narena

New User


Joined: 16 Mar 2005
Posts: 18

PostPosted: Fri Mar 18, 2005 3:24 pm    Post subject:
Reply with quote

Thanks for ur Answer Mcmillan
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 include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm
No new posts Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us