Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Picture clause in COBOL

Status
Not open for further replies.

desika7

Programmer
Jun 22, 2002
1
HK
Guys
Can any one tell me why do we have a report layout being declared like the one below in a COBOL program? that's the combiation of two different data types?

WORKING STORAGE
01 report-rec.
.....
10 detail-line.
.......
WR-XYZ PIC 9(13)X(6)

10 ABC PIC X(19).
PROCEDURE DIV
................
MOVE ABC TO WR-XYZ.
..................
WRITE REPORT-REC.

 
It might be to pad the field with leading zeros (zeroes)?
 
Interesting. I've never seen this construct "in the wild".

According to the manual and my testing, mixing 9's and A's or X's results in the picture being treated as if it were entirely X's, so 9(13)X(6) is equivalent to X(19).

The only valid use I can think for it might be an attempt to document the format of a field (e.g. a SKU that is always 13 digits followed by a suffix of up to 6 characters). Given that it's almost never used and will likely confuse others who read the code, I'd stick to X(19) and perhaps add a comment or define a field like this as a group item with constituent parts e.g.
Code:
05  WS-SKU.
    10  WS-SKU-NUM          PIC 9(13).
    10  WS-SKU-SUFFIX       PIC X(6).
[\CODE]
Regards.

Glenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top