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
 

 

DISP=NEW/MOD - Issue with output file data

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Thu Jul 04, 2013 3:23 pm    Post subject: DISP=NEW/MOD - Issue with output file data
Reply with quote

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
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Jul 04, 2013 3:54 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2163
Location: @my desk

PostPosted: Thu Jul 04, 2013 3:59 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Thu Jul 04, 2013 4:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Thu Jul 04, 2013 4:26 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Thu Jul 04, 2013 4:31 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Thu Jul 04, 2013 4:40 pm    Post subject:
Reply with quote

There is no error then, wait for some time - and things will subside in some time.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Thu Jul 04, 2013 5:29 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Dale Robertson

New User


Joined: 21 Jun 2013
Posts: 44
Location: U.S.A.

PostPosted: Mon Jul 15, 2013 10:21 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Hi,Iam trying to unwrap the data base... bhavana yalavarthi DFSORT/ICETOOL 0 Fri Dec 09, 2016 10:25 am
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
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


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