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
 
Some funny COBOL 'PIC'tures

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Dec 13, 2011 9:49 pm    Post subject: Some funny COBOL 'PIC'tures
Reply with quote

This topic from the PL/I/Assembler forum yesterday got me thinking.

The original PIC was not destined for Cobol. However, the piece without the T does compile in Cobol, giving a field length of three as Robert pointed out. dbz wondered why...

Code:

       01  W-WEIRD-000001 PIC (10)999.         
       01  W-WEIRD-000002 PIC (1)(2)(50)(2)999.
       01  W-WEIRD-000004 PIC (134217727)9.     
       01  W-WEIRD-000011 PIC (13)(4217)(727)9.
       01  W-WEIRD-000022 PIC 0(2)(4)(8)9.     
       01  W-WEIRD-000023 PIC 0(1)(1)(1)9.     
       01  W-WEIRD-000024 PIC 9(3)(1).         
       01  W-WEIRD-000025 PIC (2)S9.           
       01  W-WEIRD-000026 PIC (2)V9.           
       01  W-WEIRD-000028 PIC (3)V9(2).         
       01  W-WEIRD-000029 PIC (3)9(2)(1).       
       01  W-WEIRD-000031 PIC (3)-(2)(1).   
       01  W-WEIRD-000033 PIC (1)$9.99.
       01  W-WEIRD-000034 PIC (4)-$$9.99.


Would anyone like to guess which, if any, of the above will compile, with no diagnostic message at all.

If any do compile, how long are the fields according to the Compiler?

25 amd 33 and 34 are for things the manual (Language Reference) says. An S must be left-most, a currency left-most unless preceded by + or -. Arguably the manual is correct, as the "repetition factor" is not described as actually part of the PICture character string.

Is it a Bug? Or only an Undocumented IBM Extension?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Dec 13, 2011 11:25 pm    Post subject: Reply to: Some funny PICtures
Reply with quote

Mutually exclusive.

Code:

PIC 9(5)V9(4).

PIC (5)V9(4).


I think Bug now. If you intended the first and manged the second through fat-fingers you'd reasonably expect the compiler to give you a bit of a hint.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Dec 14, 2011 12:03 am    Post subject: Reply to: Some funny PICtures
Reply with quote

Thanks Robert. I should have made three of the fields smaller, to be within ARITH(COMPAT) rather than ARITH(EXTEND).

If you get three compile errors, reduce by 13 the bits that made it go wrong, or use ARITH(EXTEND).

Subject to the ARITH, they all compile.
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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm

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