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
 

 

Repro a VB file into VSAM

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Repro a VB file into VSAM
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Sun Nov 13, 2011 6:54 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Nov 14, 2011 4:32 am    Post subject: Reply to: Repro a vb file into VSAM
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    Post subject:
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    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
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


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