Page 1 of 1
numeric value is 1234
Posted:
Fri May 20, 2016 8:15 am
by ganeshbhaai
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).
Re: numeric value is 1234
Posted:
Fri May 20, 2016 11:36 am
by enrico-sorichetti
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
Re: numeric value is 1234
Posted:
Wed May 25, 2016 12:17 pm
by arya_starc
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
Re: numeric value is 1234
Posted:
Wed May 25, 2016 7:19 pm
by Terry Heinze
Did you check the Language Reference Manual as suggested in your other related question?
Re: numeric value is 1234
Posted:
Wed May 25, 2016 7:33 pm
by Robert Sample
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.