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

problem with output datatset


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 10:56 am
Reply with quote

Hi all,

I am having a cobol program. The program takes input from a file and finally writes into output file. Then I am closing a file and invoking another JCL thru INTRDR before stop run. However I am getting JCL error for invoked JCL as input file not found.
I need to know whether output file in program would actually be available. I mean whether after stop run, after closing the file or any other execution. Please suggest.
Back to top
View user's profile Send private message
manishmittal

New User


Joined: 25 Apr 2008
Posts: 49
Location: Gurgaon

PostPosted: Wed May 27, 2009 2:17 pm
Reply with quote

One way to find this is after closing the file just try to read it immediately or you can make use of File-Status.Not sure though.
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 2:58 pm
Reply with quote

I am calling another proc which use a GENER taking this file as input. But I am getting error in GENER as "input file not found". So I guess, the file would be available after stop run. But I am not sure therefore I am seeking help in this regard.
Back to top
View user's profile Send private message
manishmittal

New User


Joined: 25 Apr 2008
Posts: 49
Location: Gurgaon

PostPosted: Wed May 27, 2009 3:04 pm
Reply with quote

My suggestion is again the same.After you closed the file just try to read it in the same code but after removing the GENER utiltity so that you can test on your own.
Suppose if file has been closed before stop run then you cannot read it and you will get file is not opened error OR if it is still not closed then you will be able to read it successfully.
Its just a test.
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 3:49 pm
Reply with quote

Please let me know how can read the file without opening it. We will surely get file status error code. I do not know any method by which a file can be read without opening it as you are suggesting.
Actually my requirement is simple, I need to know whether a file is available to outside for reading after stop run or closing the file.
Please excuse me if I sound offensive.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed May 27, 2009 3:52 pm
Reply with quote

are You sure that the jcl is written properly ?
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 4:20 pm
Reply with quote

yes...I am pretty much sure.... that's the basic GENER step...so I do not have any doubt about this.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 27, 2009 4:24 pm
Reply with quote

Does the file show up in 3.4
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed May 27, 2009 4:36 pm
Reply with quote

Quote:
input file not found

do You get a jcl error or what ?

I just reread your first post, You got a jcl error!
I trust jcl more than anybody else judgment,

up to now You did not post anything useful, to help You we need facts
please post the jcl used, and the jes log/sysout
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 5:34 pm
Reply with quote

Ok guys...let me clear the sky...
here is the requirement...I have an input file which is having records like:

NAVEEN524658764313576
216576464576764466767
257676545465765464465
NAVEEN24657654324463
255243434323434343433
NAVEEN16546461564989

I have to write group of records in output files based on some string.
For example, whenever the first 6 characters are 'NAVEEN' then it should write in separate files. Therefore very first record would go in first file. Records 2,3 and 4 will go to second file. Records 5 and 6 will be in third file and so on. There can be any number of 'NAVEEN' in input file.
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 5:38 pm
Reply with quote

The progrm I have written is:

IDENTIFICATION DIVISION.
PROGRAM-ID. TEST12.
AUTHOR. SHARAD SRIVASTAVA.

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO INFILE.
SELECT OUTFILE ASSIGN TO OUTFILE.

DATA DIVISION.
FILE SECTION.

FD INFILE
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
DATA RECORD IS IN-REC.
01 IN-REC PIC X(080).

FD OUTFILE
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
DATA RECORD IS OUT-REC.
01 OUT-REC PIC X(080).

WORKING-STORAGE SECTION.
01 WS-SWITCHES.
05 NEWFILE-SW PIC X(01) VALUE 'Y'.
05 INFILE-EOF PIC X(01) VALUE 'N'.

PROCEDURE DIVISION.
0000-MAINLINE.
OPEN INPUT INFILE OUTPUT OUTFILE.
PERFORM 1111-READ UNTIL INFILE-EOF = 'Y'.
CLOSE INFILE OUTFILE.
STOP RUN.

1111-READ.
READ INFILE AT END MOVE 'Y' TO INFILE-EOF
END-READ
IF INFILE-EOF IS NOT EQUAL TO 'Y' THEN
PERFORM 2222-PROCESS
END-IF.

2222-PROCESS.
MOVE IN-REC TO OUT-REC
WRITE OUT-REC
IF IN-REC (1:6) = 'NAVEEN' THEN
PERFORM 3333-NEW
END-IF.

3333-NEW.
CLOSE OUTFILE
DISPLAY '//TEST12 JOB (PROD,0401,999,999,,4100),'
DISPLAY '// CLASS=D,MSGCLASS=8,'
DISPLAY '// REGION=0M'
DISPLAY '//STEPAA EXEC PGM=IEBGENER'
DISPLAY '//SYSIN DD DUMMY'
DISPLAY '//SYSUT1 DD DSN=TB@CSSVC.SHARAD.OUT,'
DISPLAY '// DISP=SHR'
DISPLAY '//SYSUT2 DD DSN=TB@CSSVC.SHARAD.TT(+1),'
DISPLAY '// DISP=(NEW,CATLG,DELETE),'
DISPLAY '// UNIT=DISK,'
DISPLAY '// SPACE=(CYL,(10,10),RLSE),'
DISPLAY '// DCB=RECFM=FB'
DISPLAY '//SYSPRINT DD SYSOUT=*'
DISPLAY '//SYSOUT DD SYSOUT=*'
DISPLAY '//*'.
DISPLAY '//STEPBB EXEC PGM=IEBGENER'
DISPLAY '//SYSIN DD DUMMY'
DISPLAY '//SYSUT1 DD DUMMY'
DISPLAY '//SYSUT2 DD DSN=TB@CSSVC.SHARAD.TT(+1),'
DISPLAY '// DISP=(NEW,CATLG,DELETE)'
DISPLAY '// UNIT=DISK,SPACE=(CYL,(1,5),RLSE),'
DISPLAY '// DCB=RECFM=FB'
DISPLAY '//SYSPRINT DD SYSOUT=*'
DISPLAY '//SYSOUT DD SYSOUT=*'
DISPLAY '//*'
OPEN OUTPUT OUTFILE.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 27, 2009 5:40 pm
Reply with quote

So what has that got to do with a "Missing" file

I think that Enrico was wanting some useful information like ...........

How are these files allocated.
How does the submitted JCL know which file to process.
Does the JCL error occur for every subsequent submitted job or only some.
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 5:40 pm
Reply with quote

The JCL is:

//TEST12 JOB (PROD,0401,999,999,,4100),'REEP-SAP EXT/FORMAT ',
// CLASS=D,MSGCLASS=8,NOTIFY=&SYSUID
//*
//STEP00 EXEC PGM=IEFBR14
//DD1 DD DSN=TB@CSSVC.SHARAD.OUT,
// DISP=(MOD,DELETE,DELETE)
//*
//STEP07 EXEC PGM=TEST12
//STEPLIB DD DISP=SHR,DSN=PB@OPERS.CMNSTG.WMCS.#003431.LOD
//SYSOUT DD SYSOUT=(*,INTRDR)
//SYSUDUMP DD SYSOUT=*
//INFILE DD DSN=TB@CSSVC.SHARAD.INP,DISP=SHR
//OUTFILE DD DSN=TB@CSSVC.SHARAD.OUT,DISP=(NEW,CATLG,DELETE),
// UNIT=(DISK,3),SPACE=(CYL,(10,10),RLSE)
//*
//STEP08 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD DSN=TB@CSSVC.SHARAD.OUT,DISP=SHR
//SYSUT2 DD SYSOUT=*
//*
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 27, 2009 5:49 pm
Reply with quote

Predefine TB@CSSVC.SHARAD.OUT and remove the delete step in your JCL. Data sets are not cataloged until the end of the step; you are attempting to use a cataloged data set in the middle of the step that creates the data set. This, by definition, will fail.
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 6:17 pm
Reply with quote

Done. Job shows that it is completing with MAX CC =00 but no version of GDG is created.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 27, 2009 6:21 pm
Reply with quote

Sigh. First problem solved. Second one starts.

What output and error messages (if any) show up for TEST12 job (the one you submit via internal reader)?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 27, 2009 6:25 pm
Reply with quote

sharad_shanu wrote:
Done. Job shows that it is completing with MAX CC =00 but no version of GDG is created.

Unfortunately today is not psychic day, so would you care to tell us where the GDG GENERATION should have been created.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 27, 2009 6:30 pm
Reply with quote

Quote:
Unfortunately today is not psychic day
Was it yesterday?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 27, 2009 6:31 pm
Reply with quote

Not that I fore saw
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 6:40 pm
Reply with quote

I aplogize but I am using internal reader and the invoked JCL is supposed to create GDG. Please have a look at cobol code.
There is no error message. GDG versions are created but the first is having only one record (last record) and rest all versions are empty. Also JCL shows only one step of the GDG creation (STEPAA). I am not too sure but it might be linked with closure and opening of file before each JCL.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 27, 2009 6:43 pm
Reply with quote

sharad_shanu wrote:
I aplogize but I am using internal reader and the invoked JCL is supposed to create GDG. Please have a look at cobol code.
There is no error message. GDG versions are created but the first is having only one record (last record) and rest all versions are empty. Also JCL shows only one step of the GDG creation (STEPAA). I am not too sure but it might be linked with closure and opening of file before each JCL.

/RANT ON
I aplogize but I am using internal reader and the invoked JCL is supposed to create GDG. Please have a look at cobol code.
There is no error message. GDG generations are created but the first is having only one record (last record) and rest all generations are empty. Also JCL shows only one step of the GDG creation (STEPAA). I am not too sure but it might be linked with closure and opening of file before each JCL
/ RANT OFF

Please use the correct terms !
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 27, 2009 7:08 pm
Reply with quote

Once you predefined the file, what does your modified JCL look like? Does it specify DISP=SHR or DISP=OLD for the OUTFILE DD name? If so, then each time your COBOL program opens the file for output all previous records are deleted. You must use DISP=MOD to keep the previous records.

Also note that the way your code was posted, you will submit the job to the internal reader each time your condition (bytes 1 - 6 of the input record containing NAVEEN) is hit; are you sure you're wanting to submit the job that many times?

And I emphasize the terminology point raised earlier -- if you don't know the difference between a GDG version and a GDG generation you are going to run into problems in the future.
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 7:17 pm
Reply with quote

here is my modified JCL:

//TEST12 JOB (PROD,0401,999,999,,4100),'REEP-SAP EXT/FORMAT ',
// CLASS=D,MSGCLASS=8,NOTIFY=&SYSUID
//*
//STEP07 EXEC PGM=TEST12
//STEPLIB DD DISP=SHR,DSN=PB@OPERS.CMNSTG.WMCS.#003431.LOD
//SYSOUT DD SYSOUT=(*,INTRDR)
//SYSUDUMP DD SYSOUT=*
//INFILE DD DSN=TB@CSSVC.SHARAD.INP,DISP=SHR
//OUTFILE DD DSN=TB@CSSVC.SHARAD.OUT,DISP=SHR
//*
//STEP08 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD DSN=TB@CSSVC.SHARAD.OUT,DISP=SHR
//SYSUT2 DD SYSOUT=*
//*
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 7:19 pm
Reply with quote

Ans regarding your second question - yes, I need to invoke internal reader multiple times. This is related to my requirement.

For generation, my mistake. I was talking about versions.
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed May 27, 2009 7:20 pm
Reply with quote

Also since i am writing bunch a records bertween two 'NAVEEN' therefore I am ok with file getting empty at each open. Invoked JCL will gener those many records prior to re-opening of the file.
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
Search our Forums:

Back to Top