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

What will happen if empty vsam file is opened for input


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
knd_r
Currently Banned

New User


Joined: 18 Mar 2005
Posts: 48

PostPosted: Mon May 23, 2005 11:35 am
Reply with quote

hi,

what will happen if empty vsam file is opened for input?

bye,
ks reddy.
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Mon May 23, 2005 11:57 am
Reply with quote

nothing, when u will try to read on the first read only it will give eof reached.
Back to top
View user's profile Send private message
krishh

New User


Joined: 20 May 2005
Posts: 12

PostPosted: Mon May 23, 2005 6:44 pm
Reply with quote

hai,
a vsam file which is empty and if you want to read the empty file it is treated as unavilable.
so first open the vsam file for output and write dummy record in it.
Back to top
View user's profile Send private message
knd_r
Currently Banned

New User


Joined: 18 Mar 2005
Posts: 48

PostPosted: Mon May 23, 2005 7:27 pm
Reply with quote

then what is the vsam status code 13?
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Mon May 23, 2005 10:27 pm
Reply with quote

There is no VSAM Status Code 13 as for as I know.

Quote:
if u attenpt to open an empty vsam file u will get the error 160.
to over come this write a dummy program which opens it and closes it.



Code:
 EVALUATE VSAM-STATUS-CODE
003300     WHEN '00' DISPLAY 'SUCCESSFUL COMPLETION'
003400     WHEN '02' DISPLAY 'DUPLICATE KEY, NON UNIQ. ALT INDX'
003500     WHEN '04' DISPLAY 'READ, WRONG LENGTH RECORD'
003600     WHEN '05' DISPLAY 'OPEN, FILE NOT PRESENT'
003700     WHEN '07' DISPLAY 'CLOSE OPTION INCOMPAT FILE DEVICE'
003800               DISPLAY 'OPEN IMPLIES TAPE; TAPE NOT USED'
003900     WHEN '10' DISPLAY 'END OF FILE'
004000     WHEN '14' DISPLAY 'RRN > RELATIVE KEY DATA'
004100     WHEN '20' DISPLAY 'INVALID KEY VSAM KSDS OR RRDS'
004200     WHEN '21' DISPLAY 'SEQUENCE ERROR, ON WRITE'
004300               DISPLAY 'OR CHANGING KEY ON REWRITE'
004400     WHEN '22' DISPLAY 'DUPLICATE KEY'
004500     WHEN '23' DISPLAY 'RECORD OR FILE NOT FOUND'
004600     WHEN '24' DISPLAY 'BOUNDARY VIOLATION.'
004700               DISPLAY 'WRITE PAST END OF KSDS RECORD '
004800               DISPLAY 'COBOL 370: REL: REC# TOO BIG'
004900               DISPLAY 'OUT OF SPACE ON KSDS/RRDS FILE'
005000     WHEN '30' DISPLAY 'PERMANENT DATA ERROR'
005100               DISPLAY 'DATA CHECK, PARITY CHK, HARDW'
005200     WHEN '34' DISPLAY 'BOUNDARY VIOLATION'
005300               DISPLAY 'WRITE PAST END OF ESDS RECORD'
005400               DISPLAY 'OR NO SPACE TO ADD KSDS/RRDS RECORD'
005500               DISPLAY 'OUT OF SPACE ON SEQUENTIAL FILE'
005600     WHEN '35' DISPLAY 'OPEN, FILE NOT PRESENT'
005700     WHEN '37' DISPLAY 'OPEN MODE INCOMPAT WITH DEVICE'
005800     WHEN '38' DISPLAY 'OPENING FILE CLOSED WITH LOCK'
005900     WHEN '39' DISPLAY 'OPEN, FILE ATTRIB CONFLICTING'
006000     WHEN '41' DISPLAY 'OPEN, FILE IS OPEN'
006100     WHEN '42' DISPLAY 'CLOSE, FILE IS CLOSED'
006200     WHEN '43' DISPLAY 'DELETE OR REWRITE & NO GOOD READ FIRST'
006300     WHEN '44' DISPLAY 'BOUNDARY VIOLATION/REWRITE REC TOO BIG'
006400     WHEN '46' DISPLAY 'SEQUENTIAL READ WITHOUT POSITIONING'
006500     WHEN '47' DISPLAY 'READING FILE NOT OPEN AS INPUT/IO/EXTEND'
006600     WHEN '48' DISPLAY 'WRITE WITHOUT OPEN IO'
006700     WHEN '49' DISPLAY 'DELETE OR REWRITE WITHOUT OPEN IO'
006800     WHEN '90' DISPLAY 'UNKNOWN'
006900     WHEN '91' DISPLAY 'VSAM - PASSWORD FAILURE'
007000     WHEN '92' DISPLAY 'LOGIC ERROR/OPENING AN OPEN FILE'
007100               DISPLAY 'OR READING OUTPUT FILE'
007200               DISPLAY 'OR WRITE INPUT FILE'
007300               DISPLAY 'OR DEL/REW BUT NO PRIOR READ'
007400     WHEN '93' DISPLAY 'VSAM - VIRTSTOR. RESOURCE NOT AVAILABLE'
007500     WHEN '94' DISPLAY 'VSAM - SEQUENTIAL READ AFTER END OF FILE'
007600               DISPLAY 'OR NO CURRENT REC POINTER FOR SEQ'
007700     WHEN '95' DISPLAY 'VSAM - INVALID FILE INFORMATION'
007800               DISPLAY 'OR OPEN OUTPUT (LOAD) '
007900               DISPLAY   'WITH FILE THAT NEVER CONTNED DATA'
008000     WHEN '96' DISPLAY 'VSAM - MISSING DD STATEMENT IN JCL'
008100     WHEN '97' DISPLAY 'VSAM - OPEN OK, FILE INTEGRITY VERIFIED'
008200               DISPLAY 'FILE SHOULD BE OK'
008300     WHEN OTHER DISPLAY 'UNKNOWN REASON' VSAM-STATUS-CODE
008400     END-EVALUATE.
008800
008801*   From http://www.theamericanprogrammer.com commercial use
008802*   or resale of this document is a violation of copyright laws.
008900 EVALUATE-VSAM-EXTENDED-RETURN-CODE.
009000     EVALUATE VSAM-EXTENDED-RETURN-CODE
009100     WHEN 0 DISPLAY 'SUCCESSFUL COMPLETION'
009200     WHEN 4 DISPLAY 'ANOTHER REQUEST IS ACTIVE'
009300     WHEN 8 DISPLAY 'THERE IS A LOGICAL ERROR'
009400             PERFORM EVALUATE-LOGICAL-ERROR
009500     WHEN 12 DISPLAY 'THERE IS A PHYSICAL ERROR'
009600             PERFORM EVALUATE-PHYSICAL-ERROR
009700     WHEN OTHER DISPLAY 'UNKNOWN REASON'
009800     END-EVALUATE.
009900
010000 EVALUATE-VSAM-EXTENDED-FUNCTION-CODE.
010100     EVALUATE VSAM-EXTENDED-FUNCTION-CODE
010200     WHEN 0 DISPLAY 'ACCESSING BASE CLUSTER, NO PROBLEM'
010300     WHEN 1 DISPLAY 'ACCESSING BASE CLUSTER, MAY BE A PROBLEM'
010400     WHEN 2 DISPLAY 'ACCESSING ALTERNATE INDEX, NO PROBLEM'
010500     WHEN 3 DISPLAY 'ACCESSING ALTERNATE INDEX, MAY BE A PROBLEM'
010600     WHEN 4 DISPLAY 'UPGRADE PROCESSING, NO PROBLEM'
010700     WHEN 5 DISPLAY 'UPGRADE PROCESSING, MAY BE A PROBLEM'
010800     WHEN OTHER DISPLAY 'UNKNOWN REASON'
010900     END-EVALUATE.
011000
011100 EVALUATE-PHYSICAL-ERROR.
011200*    USE THIS WHEN THERE IS RC 12 IN VSAM-EXTENDED-RETURN-CODE
011300     EVALUATE VSAM-EXTENDED-FEEDBACK-CODE
011400     WHEN 4 DISPLAY 'READ ERROR ON DATA'
011500     WHEN 8 DISPLAY 'READ ERROR ON INDEX'
011600     WHEN 12 DISPLAY 'READ ERROR IN SEQUENCE SET'
011700     WHEN 16 DISPLAY 'WRITE ERROR ON DATA'
011800     WHEN 20 DISPLAY 'WRITE ERROR ON INDEX'
011900     WHEN 24 DISPLAY 'WRITE ERROR IN SEQUENCE SET'
012000     WHEN OTHER DISPLAY 'UNKNOWN REASON'
012100     END-EVALUATE.
012200
012300 EVALUATE-LOGICAL-ERROR.
012400*    USE THIS WHEN THERE IS RC  8 IN VSAM-EXTENDED-RETURN-CODE
012500     EVALUATE VSAM-EXTENDED-FEEDBACK-CODE
012600     WHEN   4 DISPLAY 'READ PAST END OF FILE'
012700     WHEN   8 DISPLAY 'DUPLICATE KEY'
012800     WHEN  12 DISPLAY 'KEY SEQUENCE ERROR'
012900     WHEN  16 DISPLAY 'NOT FOUND'
013000     WHEN  20 DISPLAY 'CONTROL INTERVAL IN USE BY OTHER JOB'
013100     WHEN  24 DISPLAY 'VOLUME CANNOT BE MOUNTED'
013200     WHEN  28 DISPLAY 'UNABLE TO EXTEND DATASET'
013300     WHEN  32 DISPLAY 'RBA NOT FOUND'
013400     WHEN  36 DISPLAY 'KEY IS NOT IN A DEFINED KEY RANGE'
013500     WHEN  40 DISPLAY 'INSUFFICIENT VIRTUAL STORAGE'
013600     WHEN  64 DISPLAY 'NO AVAILABLE STRINGS'
013700     WHEN  68 DISPLAY 'OPEN DID NOT SPECIFY PROC TYPE'
013800     WHEN  72 DISPLAY 'KEY ACCESS TO ESDS OR RRDS'
013900     WHEN  76 DISPLAY 'ATTEMPTED INSERT TO WRONG TYPE DATASET'
014000     WHEN  80 DISPLAY 'ATTEMPTED DELETE FROM ESDS'
014100     WHEN  84 DISPLAY 'OPTCD LOC FOR PUT REQUEST'
014200     WHEN  88 DISPLAY 'POSITION NOT ESTABLISHED'
014300     WHEN  92 DISPLAY 'PUT WITHOUT GET FOR UPDATE'
014400     WHEN  96 DISPLAY 'TRYING TO CHANGE PRIMARY KEY'
014500     WHEN 100 DISPLAY 'TRYING TO CHANGE LRECL'
014600     WHEN 104 DISPLAY 'INVALID RPL OPTIONS'
014700     WHEN 108 DISPLAY 'INVALID LRECL'
014800     WHEN 112 DISPLAY 'INVALID KEY LENGTH'
014900     WHEN 116 DISPLAY 'VIOLATED LOAD MODE RESTRICTION'
015000     WHEN 120 DISPLAY 'WRONG TASK SUBMITTING REQUEST'
015100     WHEN 132 DISPLAY 'TRYING TO GET SPANNED REC IN LOC MODE'
015200     WHEN 136 DISPLAY 'TRYING TO GET SPANNED REC BY ADDRESS'
015300              DISPLAY 'IN KSDS'
015400     WHEN 140 DISPLAY 'INCONSISTENT SPANNED REC'
015500     WHEN 144 DISPLAY 'ALT INDEX POINTER WITH NO MATCHING'
015600              DISPLAY 'BASE RECORD'
015700     WHEN 148 DISPLAY 'EXCEEDED MAX POINTERS IN ALT INDEX REC'
015800     WHEN 152 DISPLAY 'INSUFFICIENT BUFFERS AVAILABLE'
015900     WHEN 156 DISPLAY 'INVALID CONTROL INTERVAL'
016000     WHEN 192 DISPLAY 'INVALID RELATIVE REC NUMBER'
016100     WHEN 196 DISPLAY 'ATTEMPTED ADDRESSED REQUEST TO RRDS'
016200     WHEN 200 DISPLAY 'INVALID ACCESS THROUGH A PATH'
016300     WHEN 204 DISPLAY 'PUT IN BACKWARD MODE'
016400     WHEN 208 DISPLAY 'INVALID ENDREQ MACRO'
016500     WHEN OTHER DISPLAY 'UNKNOWN REASON'
016600     END-EVALUATE.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue May 24, 2005 1:55 am
Reply with quote

I'm curious to know how this situation could ever happen? I have never heard of a shop that would allow a new VSAM file definition to be run without a step to initialize the index-key to low-values. Is this not a standard practice, or are these questions more academic than real-world?
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue May 24, 2005 6:24 am
Reply with quote

There can be 2 kinds of "empty" VSAM files. Files that never contained data and files that did but was later deleted.

Attempting to READ the 1st type results in an error condition; READing the 2nd type results in an EOF condition on the 1st READ.
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Tue May 24, 2005 9:40 am
Reply with quote

hi jack,
one query, like you said

Quote:

There can be 2 kinds of "empty" VSAM files. Files that never contained data and files that did but was later deleted.

Attempting to READ the 1st type results in an error condition;


but when VSAM file is defined previously some where else and no data is loaded into that, but all index and data part for it's cluster is created successfully , then also will it give error while reading in program or it will show EOF.
Please clear my doubt...
thanks in advance
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed May 25, 2005 6:08 am
Reply with quote

Hi Kanak,

I don't understand:
Quote:

then also will it give error while reading in program or it will show EOF.

How can it do both?
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Wed May 25, 2005 9:30 am
Reply with quote

hi jack,
i mean to say that what will happen.
will it give error??? OR it will show EOF???.
Hope now you are clear with my doubt.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu May 26, 2005 5:52 am
Reply with quote

Hi Kanak,

Any VSAM file that has never contained data cannot be successfully READ.

If a VSAM file contained data at some point in the past (i.e. records were written to it) and that data was later deleted, you could successfully READ the file but you would encounter an EOF condition on the 1st READ (SC=10).

A similar condition exists when flat files are empty. They can be uninitialized (allocated, but never successfully OPENed and CLOSEd) or they can be functioning but empty files.
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Thu May 26, 2005 9:39 am
Reply with quote

thanks jack for ur reply.Now got more better idea abt VSAM.
Back to top
View user's profile Send private message
akatast

New User


Joined: 05 Mar 2009
Posts: 15
Location: Ohio

PostPosted: Fri Jul 31, 2009 7:45 pm
Reply with quote

@Priya,
VSAM Status Code 13 is there and I got that once. go througt this link www.simotime.com/vsmfsk01.htm
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: Sat Aug 01, 2009 6:12 am
Reply with quote

Hello and welcome to the forum,

It is more productive to reply to currently active topics rather than one that has been inactive for over 4 years icon_smile.gif

Enjoy the forum,

d
Back to top
View user's profile Send private message
bajibabu

New User


Joined: 01 Aug 2005
Posts: 5
Location: hyderabad

PostPosted: Thu Jan 13, 2011 12:55 pm
Reply with quote

you will get vsam file status 35.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Thu Jan 13, 2011 1:00 pm
Reply with quote

Dick - I can read your post, can others? icon_smile.gif
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: Thu Jan 13, 2011 8:38 pm
Reply with quote

Hi Anuj,

Most can - many don't icon_wink.gif

We can only try. . .

d
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Jan 13, 2011 10:38 pm
Reply with quote

You mean I waded thru all of this again for
Quote:
Dick - I can read your post, can others?
and
Quote:
Most can - many don't
?
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: Fri Jan 14, 2011 12:45 am
Reply with quote

Hi Phil,

Wade if ya wanna. . . we won't charge any extra icon_cool.gif

I tend to scrool down to the most current posts and then (if needed) look at the earlier stuff. . .

d
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jan 14, 2011 2:09 am
Reply with quote

"scrool" - I imagine you meant scroll, but thinking about it, "scrool" could be a pretty cool word. icon_smile.gif We just need to think of a real good definition for it - like "screaming drool" or "school rules" or ...
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: Fri Jan 14, 2011 2:41 am
Reply with quote

Yup, went keylexic - wrong double-letter. . . and they're so close on the keyboard . . . icon_rolleyes.gif
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 14, 2011 2:43 am
Reply with quote

As soon as the program gains control, issue a CALL to IKJEFT01, building a PRINT INDATASET('YOUR.VSAM.FILE') COUNT(0) TSO command.

To make things easier, pass the DSN in a PARM card and let the program extract the DSN.

Upon return from IKJEFT01, if the LASTCC=0, then the file has data or had a record (or multiple records) written to it at one time and its/they've been deleted. It can then be opened as INPUT or I-O.

If the LASTCC=4, then the file is truly < EMPTY > and it needs to be opened as OUTPUT.

If the LASTCC is other than 0 and other than 4, then you've got other problems, such as the file is open/enabled to CICS.

You'll get several hundred hits for "IKJEFT01" when searched-for on all the IBMMAINFRAME forums.

You can experiment with the PRINT INDATASET('YOUR.VSAM.FILE') COUNT(0) TSO command after exiting ISPF, then followed by the Ready prompt and from here you can enter the command.

HTH....

Bill
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: Fri Jan 14, 2011 2:45 am
Reply with quote

I don't know ... I like the sound of

Quote:
When I read the post asking for __________ , I scrooled.
You can fill in the blank appropriately.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jan 14, 2011 2:53 am
Reply with quote

Quote:
Yup, went keylexic - wrong double-letter. . . and they're so close on the keyboard


Funny coincidence. I was just listening to NPR in my car and they were talking about funny "autocorrections" where the "smart" phone changes words you type to other words. They had some funny examples like changing Taos to Tacos, babe to baboon, and princess to primate. They said there's even a website dedicated to it.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top