occurs declaration



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

occurs declaration

Postby ramesh reddy » Wed Nov 02, 2011 12:02 pm

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.
ramesh reddy
 
Posts: 9
Joined: Fri Jan 28, 2011 7:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: occurs declaration

Postby BillyBoyo » Wed Nov 02, 2011 1:02 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: occurs declaration

Postby ramesh reddy » Wed Nov 02, 2011 1:36 pm

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.
ramesh reddy
 
Posts: 9
Joined: Fri Jan 28, 2011 7:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: occurs declaration

Postby BillyBoyo » Wed Nov 02, 2011 1:57 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post