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

SYNCSORT Skipping Records + Variable to Fixed


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

New User


Joined: 02 Nov 2006
Posts: 10

PostPosted: Thu May 22, 2008 5:51 am
Reply with quote

Hi,

1. I have a variable length file. I want to know if there is a Sort Utility which would eliminate the first and the last record (the ones marked blue in the file layout). I dont know the number of records in the file.

2. I want to know if there is a way I can convert the Variable length record to a fixed length record.

My requirements are such that from the variable file, I want only a part of the variable data and I dont need the fixed data. I tried using the OUTREC option for variable fields and also tried using the CONVERT option, both of which failed.

Say the file is 32756 bytes and I have fixed data to 200 bytes. I want only the variable data and from the 201st byte (want only the part which is marked in Red).

File Layout:

ABCDE<<<<<<
12324........frgreghrthrwrgs
343525......asdfd
53532353...lkdfgs
450439......dfkdjfldkf
CLKDFD<<<<<>

Sriram
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 22, 2008 11:26 am
Reply with quote

There are a lot of examples in the forum showing how this can be done, so,

a) Have you searched the forum looking at some examples.
b) Have you read your sort documentation.
c) If you have tried for yourself - please post your code and error messages.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu May 22, 2008 1:25 pm
Reply with quote

sriramd wrote:
1. I have a variable length file. I want to know if there is a Sort Utility which would eliminate the first and the last record (the ones marked blue in the file layout). I dont know the number of records in the file.
yes, INCLUDE/OMIT if you can uniqicly identify the records that you want to skip....
Quote:
2. I want to know if there is a way I can convert the Variable length record to a fixed length record.
yes....
Quote:
My requirements are such that from the variable file, I want only a part of the variable data and I dont need the fixed data. I tried using the OUTREC option for variable fields and also tried using the CONVERT option, both of which failed.
Fixed data in a variable file? What is the recfm and lrecl of the input?
Quote:
File Layout:
Code:
ABCDE<<<<<<
12324........frgreghrthrwrgs
343525......asdfd
53532353...lkdfgs
450439......dfkdjfldkf
CLKDFD<<<<<>
Does this represent your data?
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu May 22, 2008 9:50 pm
Reply with quote

Quote:
Say the file is 32756 bytes and I have fixed data to 200 bytes. I want only the variable data and from the 201st byte

Try this:
Code:
//STEP1 EXEC PGM=SORT
//SYSOUT  DD SYSOUT=*
//SORTIN  DD DISP=SHR,DSN=INPUT.DATA.VB
//SORTOUT DD DISP=(NEW,CATLG),DSN=OUTPUT.DATA.FB
//SYSIN   DD  *
   SORT FIELDS=COPY
   OUTFIL OUTREC=(205,32556),                 >>> 201 + 4 byte RDW
     INCLUDE=(5,5,CH,NE,C'ABCDE',AND,         >>> Header and Trailer start
              5,5,CH,NE,C'CLKDF'),CONVERT         in first data position after RDW
/*
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu May 22, 2008 9:53 pm
Reply with quote

The above code got misaligned even though the preview looked fine. Here is a better version of the code:
Code:

//STEP1 EXEC PGM=SORT
//SYSOUT  DD SYSOUT=*
//SORTIN  DD DISP=SHR,DSN=INPUT.DATA.VB
//SORTOUT DD DISP=(NEW,CATLG),DSN=OUTPUT.DATA.FB
//SYSIN   DD  *
   SORT FIELDS=COPY
   OUTFIL OUTREC=(205,32556),
    INCLUDE=(5,5,CH,NE,C'ABCDE',AND,   
             5,5,CH,NE,C'CLKDF'),CONVERT 
/*
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top