View previous topic :: View next topic
|
Author |
Message |
Biswajit D
New User
Joined: 17 Apr 2012 Posts: 50 Location: India
|
|
|
|
I am running a JCL and cataloging a dataset with DISP=(NEW,CATLG,DELETE)
When the job completes (maxcc 0), i find that the output DSN is created empty and no records are written in it.
Then i delete the dataset and run the same JCL with DISP=(MOD,CATLG,DELETE) the file now has the output records.
The program that writes the dataset opened it in OUTPUT mode and displays in the program show that the WRITE statement was indeed executed in both the above instances.
Is there any particular reason why this might be happening? I tried searching in the forum but could not find any topic that discusses this.
Thank You. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Probably because the program closes the file and reopens it, and with DISP=NEW will obliterate anything already there on the reopen |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Biswajit D,
Were your tests with exactly same input if such an input dataset exists for your job? Also could you show your JCL output DD statements for both runs in "Code" tags. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
What program are you executing? Assuming it's about COBOL - as expat said, are you sure OPEN mode is only OUTPUT and done only once? |
|
Back to top |
|
|
Biswajit D
New User
Joined: 17 Apr 2012 Posts: 50 Location: India
|
|
|
|
Yes. Exact same. Just changed the disposition and submitted the job.
First run:
Code: |
//FFSI121A DD DUMMY
//FFSI122A DD DSN=RACFID.OUTPUT.DATASET,
// UNIT=SYSDA,SPACE=(CYL,(50,50),RLSE),
// DCB=(RECFM=FB,LRECL=0479,BLKSIZE=00000),
// DISP=(NEW,CATLG,DELETE)
//FFSI132A DD DUMMY |
After I ran the job for the first time, output dataset got catalogued but was empty. So I deleted the dataset.
Picked up the job from spool, changed the DISP and submitted it. This time the dataset got catalogued with data.
Code: |
//FFSI121A DD DUMMY
//FFSI122A DD DSN=RACFID.OUTPUT.DATASET,
// UNIT=SYSDA,SPACE=(CYL,(50,50),RLSE),
// DCB=(RECFM=FB,LRECL=0479,BLKSIZE=00000),
// DISP=(MOD,CATLG,DELETE)
//FFSI132A DD DUMMY |
|
|
Back to top |
|
|
Biswajit D
New User
Joined: 17 Apr 2012 Posts: 50 Location: India
|
|
|
|
Yes. Open statement 1 time and close statement 1 time. Also, these statements are executed only once.
Code: |
000046 FILE-CONTROL.
000057 SELECT I122A-FILE ASSIGN UT-S-FFSI122A.
.
.
000434 PROCEDURE DIVISION.
.
.
000499 OPEN OUTPUT I122A-FILE.
.
.
000523 CLOSE I122A-FILE. |
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
There is no error then, wait for some time - and things will subside in some time. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Yes. Open statement 1 time and close statement 1 time. Also, these statements are executed only once. |
The count of open / close statements is irrelevant. And how do you KNOW they are executed only one time? Unless you do something like put DISPLAY statements in the code to prove the number of times they open / close the file, you are merely guessing about the number of executions. The behavior you described sounds precisely and exactly like the file was opened more than one time, and there have been plenty of examples on this forum of code "falling through" and executing statements the TS did not realize were executing. |
|
Back to top |
|
|
Dale Robertson
New User
Joined: 21 Jun 2013 Posts: 44 Location: U.S.A.
|
|
|
|
Biswajit D
Try 2 things. first write a delete step like this:
Code: |
//JS1DEL EXEC PGM=IEFBR14
//DD1 DD DSN=RACFID.OUTPUT.DATASET,
// SPACE=(TRK,0),DISP=(MOD,DELETE) |
put that in your jcl before your cobol program. do that to delete and uncatalog your file. strangely it seems as though the new z/OS is more forgiving and will do that for you like in UNIX however it is safer to do it explicitly so you don't have to keep doing it manually.
Next if you indeed have only run those open/close instructions just once in your program and have written to that file in the mean time then you're okay. in fact you might wish to take advantage of the cobol compiler that has been out there for decades now and not even write the close instruction!!!!!
that's right. the compile will do your work for you. take out
Code: |
000523 CLOSE I122A-FILE. |
still make sure you have your open instruction done ONCE and then of course the write instruction done multiple times until your program has "run out of gas".
Then code
Code: |
DISP=(,CATLG,DELETE) |
also I didn't see an FD. do you have one in your code? also take out the DCB parameters in your JCL as they're already there from your program!!
make sure of course that you have BLOCK 0 in the FD as that really is all you need. remember with cobol - less is better.
r |
|
Back to top |
|
|
|