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
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
William Thompson

Global Moderator


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

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

Why I-O? It appears to be just an output file......
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:57 pm
Reply with quote

No William,

I am applying the Checkpoint-Restart Logic for the program. So When I am restarting the program after an abend occurs I need to read the same file and then i should continue the process.


For this purpose I make the OPEN mode as I-O.
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 5:12 pm
Reply with quote

I think you want:
Quote:
EXTEND
Permits output operations that append to or create a file.
The EXTEND phrase is allowed for sequential access files only if the new data is written in ascending sequence.
For QSAM files, do not specify the EXTEND phrase for a multiple file reel.
If you want to append to a file, but are unsure if the file exists, use the SELECT OPTIONAL clause before opening the file in EXTEND mode. The file will be created or appended to, depending on whether the file exists.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 5:19 pm
Reply with quote

William,

But Can I read the records in an EXTEND mode?
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 5:26 pm
Reply with quote

Hello,

You might consider not doing this all in the one file. . .
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 5:29 pm
Reply with quote

Why do you need to read them?
Are you using the file for the restart info and backup?

Open input
read until eof
last record read is restart point
close
postion other input to restart point
open extend
write loop
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 5:33 pm
Reply with quote

Hi Dick,


Quote:
You might consider not doing this all in the one file. . .



I couldn't get ur view.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 5:42 pm
Reply with quote

Hi William,


for every record processed in the Input file, some data is moved to the WT-003 temporary table. This data is used to write the original report which contains the list of claim types, reimbursement amount, Number of Paid and denied claims etc... only after the successful execution of the program.


For this program I am implementing the Checkpoint - Restar Logic. For that I am taking the backup of the WT-003 temporary table in to a REPORT-BACKUP-FILE.


When an abend occurs I have a backup of the temporary table in this file. So, Whenever I restart the program I write the code to recover the data from the REPORT-BACKUP-FILE to the WT-003 temporary table.



Normally If the data is small I can use the Checkpoint-Tables using Database as in a normal process. Since the data is very large I prefer file instead of Checkpoint-tables.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 5:53 pm
Reply with quote

William,

To find out the Restart point in the input file, I maintain the latest processed record in the Checkpoint-tables. As it is small.
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 5:59 pm
Reply with quote

mkk157 wrote:
To find out the Restart point in the input file, I maintain the latest processed record in the Checkpoint-tables. As it is small.
Then why do you "need" to read the output file?
I give up, your logic is too confusing for me this morning......
And to your original question, yes, you can use OCCURS clause in the structure of the Output file.
But you can not write to a sequential file opened in I-O mode.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 6:02 pm
Reply with quote

Hi William,


Ok, I find out the problem and I am very much thankful to u for spending valuable time with me.

Problem is only with the Organization and access mode. I am just changing the code.

Thanks a lot once again.
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 7:07 pm
Reply with quote

Hello,

Similar to Bill, i too am a bit confused. . . icon_confused.gif

For this
Quote:
You might consider not doing this all in the one file. . .
i meant use 2 files for the restart/recovery. The "old" content would be copied to another file (dsn) for input processing and the "new" output file would written containing all of the data. There would be no attempt to try to provide both processes in the same file.

You might want to "walk through" your restart/recovery approach and make sure it covers all cases that may arise. Just a thought, but if the job runs for a fairly short amount of time (something more than a few minutes and less than a few hours), it may be safest to rerun from the beginning and not have the exposure to a complicated restart.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 7:19 pm
Reply with quote

Yes Dick,


I considered all the points u mentioned here.

I am using Checkpoint-tables to get the latest processed record from the input file as the data is small, and I am using one output file to save the reimbursement amount and some other parameters of the each claim in the input file.

U raise another question?

Quote:
if the job runs for a fairly short amount of time (something more than a few minutes and less than a few hours), it may be safest to rerun from the beginning and not have the exposure to a complicated restart.


I think this is also an important point. I didnot consider this in my implementtaion. Regarding this I will talk to my Team-Lead.

Can u please give 2 line description of this point. How and Where can I check the time required to complete the processing.

My assumption is, By consider the number of records in the input file we can skip that checkpoint - restart logic in the program. If the number of input records are less than 1000 then we can skip the control going into Checkpoint-restart logic.

Is my assumption true?
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 7:41 pm
Reply with quote

Hello,

Many of the places i've supported restart from the beginning for jobs that do more than a million updates - the rationale is that if no checkpointing was done, the automatic rollback could be finished before the restart was ready to run (depending on why the process abended or was canceled). If you have 1000 or so records, i'd probably leave out the complexity of a restart process. 1000 updates should run very quickly - a matter of several seconds.

If there are questions, please let us know.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Jun 12, 2007 7:50 pm
Reply with quote

Hi dick,


I agree with ur words. But Still I have a small doubt? How can I know Whether to restart from the beginning or from the abeneded record. U said this decision depends on the readon for abend.


Can I put an If condition based on the number of records in the input file like.


If wk-000-num-input-records > 100000

perform S900-000-units of recovery.

End-if.
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 9:54 pm
Reply with quote

Hello,

If you restart from the beginning, there will be no restart logic. All will be much simpler.
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
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
Search our Forums:

Back to Top