View previous topic :: View next topic
|
Author |
Message |
dipanshu
New User
Joined: 16 Jan 2006 Posts: 53 Location: pune
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
dipanshu
New User
Joined: 16 Jan 2006 Posts: 53 Location: pune
|
|
|
|
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 |
|
|
Jerry
New User
Joined: 16 Sep 2005 Posts: 42
|
|
|
|
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 |
|
|
dipanshu
New User
Joined: 16 Jan 2006 Posts: 53 Location: pune
|
|
|
|
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 |
|
|
ralph_v
New User
Joined: 07 Jul 2005 Posts: 27
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
i'm betting on >205! |
|
Back to top |
|
|
dipanshu
New User
Joined: 16 Jan 2006 Posts: 53 Location: pune
|
|
|
|
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 |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
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 |
|
|
dipanshu
New User
Joined: 16 Jan 2006 Posts: 53 Location: pune
|
|
|
|
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 |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
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 www.caliberdt.com/tips/Aug05_Variable_Length_Record_VB_RDW_BDW.htm |
|
Back to top |
|
|
dipanshu
New User
Joined: 16 Jan 2006 Posts: 53 Location: pune
|
|
|
|
Hi all,
SORT FIELDS=(1,4,BI,A)
what each parameter signifies?
Thanks,
Dipanshu G. |
|
Back to top |
|
|
dipanshu
New User
Joined: 16 Jan 2006 Posts: 53 Location: pune
|
|
|
|
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 |
|
|
|