numeric value is 1234



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

numeric value is 1234

Postby ganeshbhaai » Fri May 20, 2016 8:15 am

numeric value is 1234
pic clause is defined as PIC X(3)
pic clause is defined as PIC N(3)
how the numeric value 1234 will be populated to PIC X(3) and PIC N(3).
ganeshbhaai
 
Posts: 8
Joined: Sun May 08, 2016 6:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: numeric value is 1234

 

Re: numeric value is 1234

Postby enrico-sorichetti » Fri May 20, 2016 11:36 am

faster to test than ask.

if You do not have access to a mainframe search for a COBOL compiler that can run on Your PC
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2583
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 123 times

Re: numeric value is 1234

Postby arya_starc » Wed May 25, 2016 12:17 pm

In PIC X(3) the value is populated 123
and in PIC N(3) value is NOTHING(only spaces i guess)
N clause is usage national..because of that only i think spaces is came..please correct me if i am wrong
arya_starc
 
Posts: 106
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 4 times
Been thanked: 0 time

Re: numeric value is 1234

Postby Terry Heinze » Wed May 25, 2016 7:19 pm

Did you check the Language Reference Manual as suggested in your other related question?
.... Terry
Terry Heinze
 
Posts: 181
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 10 times
Been thanked: 11 times

Re: numeric value is 1234

Postby Robert Sample » Wed May 25, 2016 7:33 pm

N clause is usage national..because of that only i think spaces is came..please correct me if i am wrong
OK, you're wrong:
WS-NUMERIC >1234<  
EE6DEDCDCC46FFFF4444
62054459930E1234C000
 -------------------
WS-PICX    >123<    
EE6DCCE44446FFF44444
62079370000E123C0000
 -------------------
WS-PICN    >      <
EE6DCCD4444603030344
62079350000E010203C0
 -------------------
was generated from
WORKING-STORAGE SECTION.                              
 77  WS-NUMERIC                  PIC 9(04) VALUE 1234.
 77  WS-PICX                     PIC X(03).            
 77  WS-PICN                     PIC N(03).            
 PROCEDURE DIVISION.                                  
 0000-MAIN.                                            
     MOVE WS-NUMERIC             TO  WS-PICX          
                                     WS-PICN.          
     DISPLAY 'WS-NUMERIC >' WS-NUMERIC '<'.            
     DISPLAY 'WS-PICX    >' WS-PICX    '<'.            
     DISPLAY 'WS-PICN    >' WS-PICN    '<'.            
     STOP RUN.                                        
These kinds of questions are really easy to test on a mainframe. The national data is two-byte ASCII 1, 2, 3 respectively.
Robert Sample
Global moderator
 
Posts: 3308
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 217 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post