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
 

 

How to open the same file in two different programs ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
smvj007

New User


Joined: 19 Mar 2009
Posts: 1
Location: USA

PostPosted: Sat Apr 04, 2009 8:44 pm    Post subject: How to open the same file in two different programs ?
Reply with quote

How to open the same file in two different programs in one execution ?

Here's the situation explained in more detail.

There are two programs, PGM1 and PGM2. PGM1 is in PLI version and PGM2 is in EPL/I version.

These two programs are executed in batch mode through a job.

PGM1 gets kicked off by the job and it opens the file FILE1 in OUTPUT mode and writes some records to the FILE1. After writing some records to the FILE1, without closing the file FILE1, the PGM1 calls PGM2 and PGM2 opens the FILE1 again in OUTPUT mode to write some recods. When the FILE1 is opened in PGM2, the records written to FILE1 by PGM1 are wiped off and FILE1 now has only records written by PGM2. There is no explicit CLOSE for the file FILE1 in PGM2. After PGM2 execution is over, the control goes back to PGM1. The job completes with S414-08 error code. It looks like the PGM1 is attempting to write some of the records to FILE1 stored in the BUFFER storage. It looks like the program is not able to locate the records stored in the buffer storage written by PGM1 and hence the job ends with completion code S414-08.

The description for S414-08 given as

S414 - 08 - FOR A QSAM DATA SET EITHER AN I/O ERROR OCCURRED WHILE
FLUSHING THE BUFFERS DURING CLOSE PROCESSING, OR A CLOSE WAS
ISSUED IN THE CALLER'S SYNAD ROUTINE.


I would like to know how to handle this situation where the same file is opened in both PGM1 and PGM2 and how to correctly get the records written into FILE1 by both program PGM1 and PGM2.

The file FILE1 is a sequential file and it's declared as

DCL FILE1 OUTPUT RECORD ENV(FB RECSIZE(133) CTLASA TOTAL);


The FILE1 in the job is declared as,

//FILE1 DD DSN=AAAA.DSN1.FILE1,
DISP=(NEW,PASS,DELETE),
DCB=(RECFM=FBA,LRECL=133,BLKSIZE=6118),
SPACE=(TRK,(1,5),RLSE),UNIT=TEMPDISK


Please let me know if further information is needed.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Sat Apr 04, 2009 9:15 pm    Post subject:
Reply with quote

maybe:

jcl disp= mod
pgm1 open extend and close it before calling pgm2
pgm 2 open extend and close it before returning to pgm1

or you might get away with external that is used in cobol.

unfortunately, i don't know PL1, so don't know if you have an 'external' type ability
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: Sun Apr 05, 2009 8:06 am    Post subject:
Reply with quote

Hello,

Probably not what you'd prefer to hear, but as this process is new (i suspect), you might consider using a vsam file or a database table. . .
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Sun Apr 05, 2009 10:16 am    Post subject:
Reply with quote

Quote:
I would like to know how to handle this situation where the same file is opened in both PGM1 and PGM2 and how to correctly get the records written into FILE1 by both program PGM1 and PGM2.
You don't -- you've got a faulty design here. Opening the same sequential file in two programs running at the same time and attempting to write records to the file from both programs is a sure recipe for file corruption and abends. A process redesign is in order. Open the file, write the records, close the file then let the other program at the file to do the same. Or you could use VSAM with share options (but plan on writing enqueue and dequeue logic as well to ensure the file isn't corrupted by your writes).

Writing records to a file is a form of serialization on the file: that's why VSAM shareoption 2 allows as many as desired to READ the file, but only ONE to write the file. Two processes both writing to the file violates serialization and unpredictable results, at best, will occur -- and abends or file corruption are likely.

REDESIGN THE PROCESS!
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


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