Page 1 of 1

occurs declaration

PostPosted: Wed Nov 02, 2011 12:02 pm
by ramesh reddy
i have copy book like
01 XX-MST-SEGMENT-AREA.
03 XX-MST-APPLIC-POINTER OCCURS 0005.
05 XX-MST-APPLIC-CODE PIC X(2).
05 XX-MST-ID-SEQ.
07 XX-MST-APPLIC-SEG-ID PIC X(2).
07 XX-MST-APPLIC-AA-SEQ PIC S9(3) COMP-3.
05 XX-ACCT-INFO PIC X(37).
05 XX-MST-APPLIC-DATE PIC X(8).
05 XX-MST-APPLIC-ACTV-CODE PIC X.
05 FILLER PIC X(25).
05 XX-MST-APPLIC-NEW PIC X.
05 XX-MST-APPLIC-DELETE PIC X.
05 XX-MST-APPLIC-CONT PIC X.

I Want to write XX-ACCT-INFO PIC X(37) into output file field...for this how to declare the working variables in my COBOL pgm.
please tell me the declaration.

Re: occurs declaration

PostPosted: Wed Nov 02, 2011 1:02 pm
by BillyBoyo
Well, there would be five of them. You don't have an index on the OCCURS, so I guess you are using subscripts. So you need a loop-construct with subscript from one to five. Then

MOVE XX-ACCT-INFO TO wherever


You don't seem to have any indication that the table can be partly populated, so I guess there are five occurences of data all the time.

Re: occurs declaration

PostPosted: Wed Nov 02, 2011 1:36 pm
by ramesh reddy
i getting ABEND S806
like...
"XX-ACCT-INFO" WAS A TABLE ELEMENT BUT WAS NOT SUBSCRIPTED OR INDEXED.THE FIRST OCCURRENCE OF THE TABLE ELEMENT WAS ASSUMED.

Re: occurs declaration

PostPosted: Wed Nov 02, 2011 1:57 pm
by BillyBoyo
ramesh reddy wrote:i getting ABEND S806
like...
"XX-ACCT-INFO" WAS A TABLE ELEMENT BUT WAS NOT SUBSCRIPTED OR INDEXED.THE FIRST OCCURRENCE OF THE TABLE ELEMENT WAS ASSUMED.


S806 is nothing to do with your table, that is something calling something that does not exist (spelled wrong, not in steplib chain, stuff like that).

For your above message you are not using a subscript.

I notice, this is like my example, sorry :-)

MOVE XX-ACCT-INFO (subscript) TO wherever


If you post the messages related to the S806, we can sort that out as well.