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
 
FIELD(1:4): compilation is indexing the field?

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

New User


Joined: 19 May 2009
Posts: 9
Location: Spain

PostPosted: Mon Jun 22, 2009 5:24 pm    Post subject: FIELD(1:4): compilation is indexing the field?
Reply with quote

I need to validate the first 4 positions in a field.

WK-FIELD is defined as 9(8) in a copybook

IF WK-FIELD(1:4) = 8223
MOVE 1 TO WK-FIELD-2
END-IF

But surprisingly compilation gives an error, as it takes the WK-FIELD as indexed...

"WK-FIELD" WAS SUBSCRIPTED OR INDEXED, BUT WAS NOT DEFINED WITH AN "OCC... UBORDINATE TO AN ITEM WITH AN "OCCURS" CLAUSE. THE SUBSCRIPTS OR INDICES WER...

What should I do?

Thank you very much.
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jun 22, 2009 5:35 pm    Post subject:
Reply with quote

Please cut & past the definition of wk-field. What version of COBOL are you using?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jun 22, 2009 5:39 pm    Post subject:
Reply with quote

If the field is subscripted or indexed, you must specify the subscript or index as well as the reference modification location in your variable reference. Use the manuals link at the top of the page to find the details.
Back to top
View user's profile Send private message
Ensign

New User


Joined: 19 May 2009
Posts: 9
Location: Spain

PostPosted: Mon Jun 22, 2009 5:48 pm    Post subject: Reply to: FIELD(1:4): compilation is indexing the field?
Reply with quote

Craq Giegerich wrote:
Please cut & past the definition of wk-field. What version of COBOL are you using?

The definition of the field:

10 WK-SALES.
15 WK-FIELD PIC 9(08).

I'm not sure about the Cobol version, but I think it's VS Cobol II

Robert Sample wrote:
If the field is subscripted or indexed, you must specify the subscript or index as well as the reference modification location in your variable reference. Use the manuals link at the top of the page to find the details.

but the field is not indexed at all.... icon_confused.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jun 22, 2009 5:57 pm    Post subject:
Reply with quote

Post everything from the 01 level down to WK-FIELD. And contrary to your statement, COBOL thinks the field is indexed or subscripted (hence the error message) -- so posting everything from the 01 level down will let us see why COBOL thinks this.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon Jun 22, 2009 6:16 pm    Post subject:
Reply with quote

Instead of
IF WK-FIELD(1:4) = 8223
try
IF WK-FIELD(1:4) = '8223'


I never trust numeric display fields. they are too much like alphanumeric.
Back to top
View user's profile Send private message
Ensign

New User


Joined: 19 May 2009
Posts: 9
Location: Spain

PostPosted: Mon Jun 22, 2009 10:26 pm    Post subject:
Reply with quote

Solved. Thank you for all your responses.

The fact was the program was coded in 1992 and has some compilation options coded in the header that didn't allow (1:4) and treated them as index:

CBL CMPR2
*P-COMPI CICS=NO DLI=NO

Just removing these two lines (or mark them), and the problem got solved:

**CBL CMPR2
*P-COMPI CICS=NO DLI=NO

I guess they are old compilation parameters.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Jun 23, 2009 9:19 am    Post subject: Reply to: FIELD(1:4): compilation is indexing the field?
Reply with quote

Ensign,

Quote:
CBL CMPR2 guess they are old compilation parameters.


Yes, This is a compiler option and CBL is used to override the default settings of the compiler option .

So it all depends on what the site has coded for this compiler option.
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm

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