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

Repro a VB file into VSAM


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

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Sun Nov 13, 2011 6:36 pm
Reply with quote

I am copying the records in a VB file to KSDS. Job failed with key out of sequence,

Key length of the VSAM is 10.
The data in the file is in PD format hence i used the below sort card to sort
Code:

sort fields=(5,4,pd,a,9,4,pd,a,12,2,bi,a)
sum fields=none


below is the layout of the input file, hence i used the above sortcard.
Quote:

01 xxx
05 var1 s9(7) comp-3
05 var2 s9(7) comp-3
05 var3 s9(4) comp


Now, after sorting i tried to copy the data into the vsam but it again failed with key out of sequence.

so, i tried the below sort card,
Code:

sort fields=(5,10,ch,a)
sum fields=none


The records were copied without any issues,

Q1) now what i dont understand is, even though the data is in 'PD' when i tried to sort it in PD format, it didn't work. but when i tried to sort 'PD' data in character format it worked, isn't it logically wrong?

Q2) As per my production job which was written in 1970's, they are using a temporary dataset (disp=(new,pass,delete)). when the job failed and when i sorted, i used a dasd file (new,catlg,delete) and repro'd it into the VSAM. my question is does this make a difference? when i use a cataloged dataset, will the (its a VB file)record descriptor in the first 4 bytes be copied into the VSAM?

Note: I am asking Q2 because, my production jobs using the vsam file repro'd and copied in the above step is failing with S0C7.

I am trying to find the solution, i will post what i find in the forum.

@Experts in the forum,
Please help me with this.

If you need more explanation on the above scenario or if you have any questions, please let me know.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Sun Nov 13, 2011 6:54 pm
Reply with quote

Q1. No, it is not logically wrong. You do not understand the internal representation of packed decimal. Negative 1234 is stored as 0001234D in a packed decimal 4-byte field. Positive 1234 is stored as 0001234C in a packed decimal 4-byte field. Sorting as packed decimal, naturally the negative number comes before the positive number. VSAM sees your key as characters, so the 0001234D coming before 0001234C is seen as out of sequence.

Q2. Using a temporary versus permanent data set should make no difference to the processing -- the record layouts and how data is stored does not change for temporary to permanent data set. The record descriptor word in the first 4 bytes of a VB record are used to indicate the length. VSAM manages record lengths differently, so the 4-byte RDW is not stored in the VSAM file directly.
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Sun Nov 13, 2011 7:03 pm
Reply with quote

Awesome,,, Thanks Robert for spending your time to explain me on a sunday!!!! icon_biggrin.gif

Now, i understand.. the S0c7 is then an application issue not b'coz of what i did. i will look into it, thanks again
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Nov 14, 2011 4:32 am
Reply with quote

shankarm,

You are dropping duplicate keys in the sort cards you have shown. I'm wondering if that matters to you in any way?

Also, you are not using EQUALS on the sort, so unless it has been set as the default, you cannot guarantee which record makes it through the SUM statement (one will, but maybe not always the first one).

Both CH and BI will do a sort strictly on bit values. Anything else will do a "logical" sort for that field type.

VSAM uses a strictly bit value order, of necessity. As Robert says, you can regard the key as being Character values for collating purposes, nothing to do with any logical value (like -ve numbers or such things).

If you have an existing job, why are you changing the sort parameters? Something you have changed is likely to be the cause of the S0C7, so what else is changed? Or maybe you have it already?
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Mon Nov 14, 2011 5:23 am
Reply with quote

The real problem is that your file contains Variable Length Records. Hence your sort card must add 4 to the offsets for sort fields to account for the 4-byte RDW.
When you sort 5,10,CH,A you are really sorting only the first field (3-bytes), second field (4-bytes), and 3 bytes of the third field.
You should be sorting 8,4,pd,a,12,4,pd,a,16,2,bi,a if you wish to be sorting fields 2,3, and 4.
You "might" want to consider converting the file to Fixed Format during the sort step. Just sayin'.
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

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top