Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can I use OCCURS clause in the structure of the Output file
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Mon Jun 11, 2007 5:23 pm    Post subject: Can I use OCCURS clause in the structure of the Output file
Reply with quote

Hi all,

I am using one output file, I am keeping some data in the temporary talbe in the processing of the program. To keep the data parallelly in the output file, I declare the OCCURS clause in the structure of the output file.

But the problem is I am unable to write the record into the file, Even though I am able to make all the move statements are perfect.

When I expedit the data is properly moving and the Filestatus after writing is 00.

Is there anythingextra care to be taken to get the record written in the file.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Jun 11, 2007 5:28 pm    Post subject:
Reply with quote

mkk157,

Your post is bit confusing. Please come with more explanation. Also show your var declaration and other code (move, write statement etc....).
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Jun 11, 2007 5:28 pm    Post subject:
Reply with quote

You should not have any problem using occurs in your output record.
Please post your output record and tempory table.
Back to top
View user's profile Send private message
bansal

New User


Joined: 03 Jan 2007
Posts: 27
Location: Hyderabad

PostPosted: Mon Jun 11, 2007 5:31 pm    Post subject: Re: Can I use OCCURS clause in the structure of the Output f
Reply with quote

Hi,

It might be overriding with something. Please post the screenshots so that your problem can be better understood.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Mon Jun 11, 2007 5:37 pm    Post subject: Hi
Reply with quote

Hi murmohk1,

I have 1 I/P file, dummy Table, and two O/P file. One is original report and the another is the backup file.

I am implementing the checkpoint-restart logic for this program to recover the data when an abend occurs.

In the program while processing the input file the data is storing in temporary table.

To make this logic to work in this program I am moving the dat from mthe temporary table to the Backup file.

Problem is I am able to make all the data properly from Temporary table to Backup file, But I am unable to write the record into the file.

The following are declarations for this program.

Backup file Declaration:
Code:
    SELECT REPORT-BACKUP-FILE                 
                ASSIGN TO UT-S-C4511SD       
                FILE STATUS WP-999-IO-RETURN.

FD  REPORT-BACKUP-FILE                               
    RECORDING MODE F                                 
    BLOCK CONTAINS 0 RECORDS                         
    LABEL RECORDS ARE STANDARD.                       
                                                     
01 REPORT-BACKUP-RECORD.                             
    05 WB-999-ADJUD-DATE    PIC X(10) VALUE SPACE.   
    05 WB-999-PAYSUM-TY-TABLE.                       
        10 WB-999-PAYSUM-TY-ELEMENT                   
                OCCURS 30   TIMES                     
                INDEXED BY  WXT-999-PAYSUM-TY-INDEX. 
            15 WB-999-REIMB-AMT                       
                COMP-3      PIC S9(13)V99 VALUE 0.   
            15 WB-999-TO-BE-PAID                     
                COMP-3      PIC S9(9)     VALUE 0.   
            15 WB-999-TO-BE-DENIED                   
                COMP-3      PIC S9(9)     VALUE 0.   
            15 WB-999-TOTAL-CLAIMS                   
                COMP-3      PIC S9(9)     VALUE 0.   

Temporary Table Declaration:
Code:
01 WT-003-PAYSUM-TABLE.                                 
    05 WT-003-PAYSUM-ELEMENT                           
                    OCCURS 60   TIMES                   
                    INDEXED BY  WXT-001-PAYSUM-DT-INDEX.
        10 WT-003-ADJUD-DATE    PIC X(10) VALUE SPACE. 
        10 WT-003-PAYSUM-TY-TABLE.                     
            15 WT-003-PAYSUM-TY-ELEMENT                 
                    OCCURS 30   TIMES                   
                    INDEXED BY  WXT-001-PAYSUM-TY-INDEX.
                20 WT-003-REIMB-AMT                     
                    COMP-3      PIC S9(13)V99 VALUE 0. 
                20 WT-003-TO-BE-PAID                   
                    COMP-3      PIC S9(9)     VALUE 0. 
                20 WT-003-TO-BE-DENIED                 
                    COMP-3      PIC S9(9)     VALUE 0. 
                20 WT-003-TOTAL-CLAIMS                 
                    COMP-3      PIC S9(9)     VALUE 0. 

Data Transfer from Temporary talbe to file and writing it:
Code:
    PERFORM                                                     
        VARYING WXT-001-PAYSUM-DT-INDEX                         
            FROM +1 BY +1                                       
        UNTIL WXT-001-PAYSUM-DT-INDEX > 60                       
            OR WT-003-ADJUD-DATE (WXT-001-PAYSUM-DT-INDEX)       
                                  = SPACES                       
          MOVE WT-003-ADJUD-DATE(WXT-001-PAYSUM-DT-INDEX)       
                             TO WB-999-ADJUD-DATE               
          PERFORM                                               
              VARYING WXT-001-PAYSUM-TY-INDEX                   
                 FROM 1 BY 1                                     
            UNTIL WXT-001-PAYSUM-TY-INDEX > WV-C1031-MAX-ENTRIES
              MOVE WT-003-REIMB-AMT (WXT-001-PAYSUM-DT-INDEX,   
                                     WXT-001-PAYSUM-TY-INDEX)   
                  TO WB-999-REIMB-AMT(WXT-999-PAYSUM-TY-INDEX)   
              MOVE WT-003-TO-BE-PAID(WXT-001-PAYSUM-DT-INDEX,   
                                     WXT-001-PAYSUM-TY-INDEX)   
                  TO WB-999-TO-BE-PAID(WXT-999-PAYSUM-TY-INDEX) 
              MOVE WT-003-TO-BE-DENIED(WXT-001-PAYSUM-DT-INDEX, 
                                     WXT-001-PAYSUM-TY-INDEX)   
                  TO WB-999-TO-BE-DENIED(WXT-999-PAYSUM-TY-INDEX)
              MOVE WT-003-TOTAL-CLAIMS(WXT-001-PAYSUM-DT-INDEX, 
                                     WXT-001-PAYSUM-TY-INDEX)   
                  TO WB-999-TOTAL-CLAIMS(WXT-999-PAYSUM-TY-INDEX)
          END-PERFORM                                           
                                                                 
          WRITE REPORT-BACKUP-RECORD                             
                                                                 
    END-PERFORM.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Jun 11, 2007 6:51 pm    Post subject:
Reply with quote

In the inner perform, set WXT-999-PAYSUM-TY-INDEX to WXT-001-PAYSUM-TY-INDEX prior to attempting the moves.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Mon Jun 11, 2007 7:24 pm    Post subject:
Reply with quote

Hi william,

Still same problem, I am unable to write the records into the file.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Jun 11, 2007 8:05 pm    Post subject:
Reply with quote

M K K,

I would suggest to move the WRITE verb inside the inner PERFORM.
Give a try & let us know the results.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Mon Jun 11, 2007 8:17 pm    Post subject:
Reply with quote

No anuj_model,

If we move the WRITE statement into inner perform then it writes for around 25 times. But I after completion of all the move statements in the inner perform I want to write the record.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Jun 11, 2007 9:07 pm    Post subject:
Reply with quote

William Thompson wrote:
In the inner perform, set WXT-999-PAYSUM-TY-INDEX to WXT-001-PAYSUM-TY-INDEX prior to attempting the moves.

M K K,
Please show the code after this change.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Mon Jun 11, 2007 9:35 pm    Post subject:
Reply with quote

The code after adding the SET statement.

Code:
PERFORM                                                     
    VARYING WXT-001-PAYSUM-DT-INDEX                         
        FROM +1 BY +1                                       
    UNTIL WXT-001-PAYSUM-DT-INDEX > 60                       
        OR WT-003-ADJUD-DATE (WXT-001-PAYSUM-DT-INDEX)       
                              = SPACES                       
      MOVE WT-003-ADJUD-DATE(WXT-001-PAYSUM-DT-INDEX)       
                         TO WB-999-ADJUD-DATE               
      PERFORM                                               
          VARYING WXT-001-PAYSUM-TY-INDEX                   
             FROM 1 BY 1                                     
        UNTIL WXT-001-PAYSUM-TY-INDEX > WV-C1031-MAX-ENTRIES
                                                             
          SET WXT-999-PAYSUM-TY-INDEX                       
                               TO WXT-001-PAYSUM-TY-INDEX   
          MOVE WT-003-REIMB-AMT (WXT-001-PAYSUM-DT-INDEX,   
                                 WXT-001-PAYSUM-TY-INDEX)   
              TO WB-999-REIMB-AMT(WXT-999-PAYSUM-TY-INDEX)   
          MOVE WT-003-TO-BE-PAID(WXT-001-PAYSUM-DT-INDEX,   
                                 WXT-001-PAYSUM-TY-INDEX)   
              TO WB-999-TO-BE-PAID(WXT-999-PAYSUM-TY-INDEX) 
          MOVE WT-003-TO-BE-DENIED(WXT-001-PAYSUM-DT-INDEX, 
                                 WXT-001-PAYSUM-TY-INDEX)   
              TO WB-999-TO-BE-DENIED(WXT-999-PAYSUM-TY-INDEX)
          MOVE WT-003-TOTAL-CLAIMS(WXT-001-PAYSUM-DT-INDEX, 
                                 WXT-001-PAYSUM-TY-INDEX)   
              TO WB-999-TOTAL-CLAIMS(WXT-999-PAYSUM-TY-INDEX)
      END-PERFORM                                           
                                                             
      WRITE REPORT-BACKUP-RECORD                             
                             
END-PERFORM.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Jun 11, 2007 11:16 pm    Post subject:
Reply with quote

mkk157 wrote:
Still same problem, I am unable to write the records into the file.
Please define 'unable' and how do you know?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jun 12, 2007 12:26 am    Post subject:
Reply with quote

Hello,

How do you know a WRITE was ever issued?

How do you know this condition
Code:
UNTIL WXT-001-PAYSUM-DT-INDEX > 60                       
        OR WT-003-ADJUD-DATE (WXT-001-PAYSUM-DT-INDEX)       
                              = SPACES                       
is not true on the first time thru?

How do you know the "temporary table" was correctly loaded?

The FD
Code:
FD  REPORT-BACKUP-FILE                               
    RECORDING MODE F                                 
    BLOCK CONTAINS 0 RECORDS                         
    LABEL RECORDS ARE STANDARD.                       
                                                     
01 REPORT-BACKUP-RECORD.                             
    05 WB-999-ADJUD-DATE    PIC X(10) VALUE SPACE.   
has a value associated with the date field - i believe this will not work. . .
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jun 12, 2007 1:14 am    Post subject:
Reply with quote

Dick, IIRC, like values in DSECTs values in LINKAGE and FILE sections are ignored (possible W errors?).
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jun 12, 2007 1:25 am    Post subject:
Reply with quote

Yup, just tried it and got this
Code:
28  IGYDS1158-I   A NON-LEVEL-88 "VALUE" CLAUSE WAS FOUND IN THE "FILE SECTION" OR "LINKAGE SECTION".
                  TREATED AS COMMENTS.                                   
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 1:41 pm    Post subject:
Reply with quote

Hi William,

'Unable' means the records are not getting written in the file.

Dick,

The UNTIL condition is already used in another section, where the data is moving into the Temporary table for every record processing in the input file.

In the structure of the file, The WB-999-ADJUD-DATE date is associated, but I declare it as X(10). But I am just moving the date value from a hold variable to this WB-999-ADJUD-DATE.




After the successful execution of the program, When I open the output file, It doesn't contain any records in it. Why the record is not getting written into the file.


After every operation on the file I am checking for the FILE-STATUS, But every time it is 00.

Then where is the problem?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jun 12, 2007 2:01 pm    Post subject:
Reply with quote

Before the outer perform, put in a
display 'max ' WV-C1031-MAX-ENTRIES

Just before the write, put in a
display REPORT-BACKUP-RECORD

It would be nice to display the WXT-001-PAYSUM-DT-INDEX and WXT-001-PAYSUM-TY-INDEX values too.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 2:41 pm    Post subject:
Reply with quote

Hi William,

The screen shot for the SYSOUT is


MAXIMUM ENTRIES0022
RECORD2007-03-29





RECORD2007-03-28 %





MAXIMUM ENTRIES0022
RECORD2007-03-29






The SYSOUT is like this.[/quote]
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jun 12, 2007 3:21 pm    Post subject:
Reply with quote

Was "MAXIMUM ENTRIES0022" before or after the first or second perform?
Was the display of "RECORD" before or after the write?
What was the file status of the write?
Quote:
'Unable' means the records are not getting written in the file.
You seem to be executing the write, how can the records not get written....How are you verifying that they are not getting written?
What does your JCL look like?
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 3:37 pm    Post subject:
Reply with quote

Hi William,



"MAXIMUM ENTRIES0022" is before the outer PERFORM statement.

"RECORD" is before the WRITE statement and after the INNER PERFORM statement.

The Filestatus of the WRITE statement is 48.

OPEN I-O REPORT-BACKUP-FILE.

But Filestatus for OPEN statement is 00.

After the completion of the Xpediting the program, I try to open the output file, but It is empty file.

I opened the file in I-O mode But Still it is giving Filestatus 48 while writing.
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
Goto page 1, 2, 3  Next
Page 1 of 3

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us