IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can I use OCCURS clause in the structure of the Output file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Mon Jun 11, 2007 5:28 pm
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: 3156
Location: Tucson AZ

PostPosted: Mon Jun 11, 2007 5:28 pm
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
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
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: 3156
Location: Tucson AZ

PostPosted: Mon Jun 11, 2007 6:51 pm
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
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

Superior Member


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

PostPosted: Mon Jun 11, 2007 8:05 pm
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
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

Superior Member


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

PostPosted: Mon Jun 11, 2007 9:07 pm
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
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: 3156
Location: Tucson AZ

PostPosted: Mon Jun 11, 2007 11:16 pm
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

Moderator Emeritus


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

PostPosted: Tue Jun 12, 2007 12:26 am
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: 3156
Location: Tucson AZ

PostPosted: Tue Jun 12, 2007 1:14 am
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

Moderator Emeritus


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

PostPosted: Tue Jun 12, 2007 1:25 am
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
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: 3156
Location: Tucson AZ

PostPosted: Tue Jun 12, 2007 2:01 pm
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
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: 3156
Location: Tucson AZ

PostPosted: Tue Jun 12, 2007 3:21 pm
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
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
William Thompson

Global Moderator


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

PostPosted: Tue Jun 12, 2007 4:31 pm
Reply with quote

We could have saved a lot of time if you had started with this.....

What does your JCL look like? Please post it.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 4:36 pm
Reply with quote

//ACS2813A JOB (MSDV,,T),'PRELIM PYMT',
// CLASS=T,MSGCLASS=T,
// NOTIFY=&SYSUID,COND=(4,LT),REGION=40M
//*
/*JOBPARM L=9999
//* LOGONID MSPRJOB
//*
//MSDVLIB JCLLIB ORDER=(MSDV.TEST.PROCLIB)
// INCLUDE MEMBER=JOBLIB
//*********************************************************************
//* *
//* PS020 - PREIMINARY PAYMENT PROCESSING (YCMX4510) *
//* *
//* ABORT-RESTART PROCEDURES *
//* 1. RESET PGEN010 TO '+0' *
//* 2. RESTART JOB IN THIS STEP *
//* *
//*********************************************************************
//PS020 EXEC PGM=IKJEFT01,COND=(0,NE)
//***
//*** INPUT FILES
//***
//C4501SA DD DSN=MSDV.TEST.YCMX4510.INPUT2,
// DISP=SHR /* SORTED PAID/DENY CLMS
//C4501SB DD DSN=MSDV.TEST.YCMX4510.INPUT2,
// DISP=SHR /* SORTED PAID/DENY CLMS
//***
//*** OUTPUT FILES
//***
//*
//C4511SD DD DSN=MSDV.TEST.YCMX4510.OUTPUT.BACKUP,
// DISP=(MOD,KEEP,KEEP) /* BACKUP REPORT
//***
//*** SYSTEM FILES
//***
//SYSTSIN DD DSN=MSDV.TEST.SYSIN(PROG4510),DISP=SHR
//*
//PROCSMRY DD SYSOUT=*
//SYSTSPRT DD SYSOUT=* /* SYSTEM SYSTSPRT
//SYSOUT DD SYSOUT=* /* SYSTEM OUTPUT
//SYSPRINT DD SYSOUT=* /* SYSTEM PRINT
//SYSDBOUT DD SYSOUT=* /* SYSTEM SYSDBOUT
//SYSUDUMP DD SYSOUT=* /* SYSTEM DUMP
//SYSABOUT DD SYSOUT=* /* SYSTEM SYSABOUT
//
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 4:37 pm
Reply with quote

Hi William,

This is my JCL.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Tue Jun 12, 2007 4:38 pm
Reply with quote

Access mode defaults to sequential.
With sequential, a write is not permitted for a file opened I-O.
Look at Table 47. Permissible statements for sequential files
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 4:43 pm
Reply with quote

Thanks William,

I will modify the code and then i will let u know the status.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top