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
 

 

Problem in reading VSAM file sequentially.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dipanshu

New User


Joined: 16 Jan 2006
Posts: 53
Location: pune

PostPosted: Mon May 08, 2006 10:15 am    Post subject: Problem in reading VSAM file sequentially.
Reply with quote

Hi all,

I am facing the problem while reading one VSAM file sequentially giving file status 92.

Actually the VSAM file is of variable length, By giving Displays in the code I found that the code got stuck when it encounters lengthy records,
If I deleated those records the code runs fine.

I am dead sure that code hasn't any problem b'coz I tested it with other VSAM file too.

How the code depends upon the records length in the file?
Is there any other reason?

Thanks,
Dipanshu G.
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon May 08, 2006 10:25 pm    Post subject: Re: Problem in reading VSAM file sequentially.
Reply with quote

Dipanshu G,

Please give us more information.

The VSAM definition, Select, FD, 01s, code reading the file, error processing. etc. The entire porgram is not to large.

Hard to give a response with so little info.

Thnaks,

Dave
Back to top
View user's profile Send private message
dipanshu

New User


Joined: 16 Jan 2006
Posts: 53
Location: pune

PostPosted: Tue May 09, 2006 10:04 am    Post subject:
Reply with quote

Hi,

Please refer below code for the above problem.
This code performing search in Natpar(VSAM) file for N04-a1141 x(9) , As this variable is only the part of key. So I can't perform random searching.

Code using 2 copybooks detail abot them are given at the end of the code.

* NATPARM VSAM FILE

SELECT NATPARM
ASSIGN TO NATPARM
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
RECORD KEY IS N04-KEY
FILE STATUS IS X01-NATPAR-STATUS.

DATA DIVISION.
**********************
FILE SECTION.
*********************

FD NATPARM
DATA RECORDS
NP00-NATPAR-HEADER-RECORD
N04-NON-EASI-REC.
*
COPY NATHEAD.
*
01 N04-NON-EASI-REC.
COPY NATPAR04.

WORKING-STORAGE SECTION.
************************************
01 X01-FILE-STATUS.
03 X01-NATPAR-STATUS PIC X(02).

01 X04-FLAGS.
03 X04-NATPARM-SPUR-MATCH-IND PIC X(1) VALUE SPACES.
88 X04-NATPARM-SPUR-MATCH VALUE 'Y'.
88 X04-NATPARM-SPUR-MISMATCH VALUE 'N'.


PROCEDURE DIVISION.
*************************

B300-OPEN-NATPAR-FILE SECTION.
********************************
OPEN INPUT NATPARM
MOVE X01-NATPAR-STATUS TO X01-FILEIO-STATUS
MOVE 'OPENING OF NATPARM FILE FAILED'
TO X03-END-MESSAGE
PERFORM X100-CHECK-FILE-STATUS
.
B300-EXIT.
EXIT.

C324-CHECK-NATPARM-SPUR SECTION.
***************************************

READ NATPARM
AT END
MOVE 'Y' TO X04-END-OF-NATPAR-FILE-IND
NOT AT END
DISPLAY N04-KEY(4:9)
IF X06-SPUR-CODE = N04-KEY(4:9)
MOVE 'Y' TO X04-NATPARM-SPUR-MATCH-IND
MOVE 'SPUR FOUND ON NATPARM FILE' TO X03-INFO-MSG
ELSE
MOVE 'N' TO X04-NATPARM-SPUR-MATCH-IND
END-IF
END-READ
MOVE X01-NATPAR-STATUS TO X01-FILEIO-STATUS
MOVE ' READING OF NATPARM FILE FAILED'
TO X03-END-MESSAGE
PERFORM X100-CHECK-FILE-STATUS
.
C324-EXIT.
EXIT.

X100-CHECK-FILE-STATUS SECTION.
*************************************
EVALUATE TRUE
WHEN X01-FILE-OPEN-OK
CONTINUE
WHEN X01-FILE-READ-OK
CONTINUE
WHEN X01-FILE-CLOSE-OK
CONTINUE
WHEN OTHER
PERFORM Z000-ABEND-PARA
END-EVALUATE
.
X100-EXIT.
EXIT.




Copy Book - Natpar04

01 N04-NON-EASI-REC.
03 FILLER PIC X.
03 N04-KEY.
05 N04-FILE-ID PIC 9.
05 N04-RT PIC 99.
05 N04-1141 PIC X(9).
05 FILLER PIC X(21).
03 N04-4-DIG-DIST.
05 FILLER PIC 9.
05 N04-DIST PIC 999.
03 N04-NODE PIC 9(4).
03 N04-NODE-NAME PIC X(40).
01 N04-NATPARAM-LEN PIC 9(4) COMP VALUE 82.

Copy Book - Nathead

01 NP00-NATPAR-HEADER-RECORD.
03 FILLER PIC X.
03 NP00-NATPAR-KEY.
05 NP00-REGION-ID PIC X.
05 NP00-REC-TYPE PIC 99.
05 FILLER PIC X(30).
03 NP00-FILE-DETAILS OCCURS 2.
05 NP00-RUN-NUMBER PIC 9(5).
05 NP00-RUN-DATE PIC 9(6).
05 NP00-AMENDING-PROGRAM PIC X(9).
05 NP00-COMMENTS PIC 9(15).
03 FILLER PIC X(106).
Back to top
View user's profile Send private message
Jerry

New User


Joined: 16 Sep 2005
Posts: 42

PostPosted: Tue May 09, 2006 2:32 pm    Post subject:
Reply with quote

Hi Dipanshu,

May I know where you are defining the file as having variable length records and where in your copybook do you accomodate the extra 4 bytes (RWD) that you usually give for VB files. I did not find them. But you say that it works for some files. I thought that might be the reason for the problem.

Correct me if I am wrong.

Regards,
Jerry.
Back to top
View user's profile Send private message
dipanshu

New User


Joined: 16 Jan 2006
Posts: 53
Location: pune

PostPosted: Tue May 09, 2006 3:07 pm    Post subject:
Reply with quote

Hi,

I didn't know much abot the variable length file.

In my case, Records are not of same size, That's why i m saying varriable length file.

Thanks,
Dipanshu G.
Back to top
View user's profile Send private message
ralph_v

New User


Joined: 07 Jul 2005
Posts: 27

PostPosted: Tue May 09, 2006 3:14 pm    Post subject: Re: Problem in reading VSAM file sequentially.
Reply with quote

Hi,

As Jerry correctly pointed out , necessary entry needs to be given in the FD section but as far as RDW which is of 04 bytes is concerned, that will be taken in the JCL itself and no need to specify it in Cobol code.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue May 09, 2006 11:05 pm    Post subject: Re: Problem in reading VSAM file sequentially.
Reply with quote

Dipanshu G,

How long are the lengthy records that do not work and you had to delete from the file?

Your VSAM file is defined as variable 82-205 bytes. Are these records larger than 205 bytes?

Dave
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 247
Location: Cincinnati OH USA

PostPosted: Wed May 10, 2006 4:17 am    Post subject:
Reply with quote

i'm betting on >205!
Back to top
View user's profile Send private message
dipanshu

New User


Joined: 16 Jan 2006
Posts: 53
Location: pune

PostPosted: Wed May 10, 2006 9:59 am    Post subject:
Reply with quote

This is all about the VSAM dataset I m using.


Device type: 3390
Organization: KSDS
KSDS key length: 33
KSDS key location: 1
Average record size: 1000
Maximum record size: 4937

Pls let me know if any buddy req more info.

Thanks,
Dipanshu G
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 247
Location: Cincinnati OH USA

PostPosted: Wed May 10, 2006 6:00 pm    Post subject:
Reply with quote

sort the file upon length field (1,4,bi,a) and output as v (unblocked).


look at first record for length (rdw)

look at last record for length (rdw)


are they within the min/max determined by your rec layout as described in prev msg.
Back to top
View user's profile Send private message
dipanshu

New User


Joined: 16 Jan 2006
Posts: 53
Location: pune

PostPosted: Wed May 10, 2006 6:27 pm    Post subject:
Reply with quote

Hi Dave,

Pls explain wat is RDW and

how to sort file upon length field (1,4,bi,a) and output as v (unblocked) ?

Thanks,
Dipanshu G.
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 247
Location: Cincinnati OH USA

PostPosted: Thu May 11, 2006 3:07 am    Post subject:
Reply with quote

SORT FIELDS=(1,4,BI,A) will sort each variable length record on its size as specified in the Record Descriptor Word (located in first 4 bytes of a variable length record).


specify output file with RECFM=V which will create output file as variable length, but unblocked. A simple viewing of the first and last record with give the smallest and largest records. The exact size in in the first 2 bytes of each record (the last two bytes are x'0000')

see here http://www.caliberdt.com/tips/Aug05_Variable_Length_Record_VB_RDW_BDW.htm
Back to top
View user's profile Send private message
dipanshu

New User


Joined: 16 Jan 2006
Posts: 53
Location: pune

PostPosted: Thu May 11, 2006 9:11 am    Post subject:
Reply with quote

Hi all,

SORT FIELDS=(1,4,BI,A)

what each parameter signifies?

Thanks,
Dipanshu G.
Back to top
View user's profile Send private message
dipanshu

New User


Joined: 16 Jan 2006
Posts: 53
Location: pune

PostPosted: Thu May 11, 2006 12:49 pm    Post subject:
Reply with quote

Hi All,

Actually, The prob is with copy book I m using which is not compatible will all the records in the file.

Thanks all for ur co-operation.
Dipanshu G.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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