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

Syncsort - How to use sort to copy selected blocks from file


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

New User


Joined: 28 Dec 2006
Posts: 15
Location: mumbai

PostPosted: Thu Jul 09, 2009 11:38 pm
Reply with quote

I have the below records in input file
abcd
1 header
efgh
ijk
lmn
opq
5 Trailer
rst
uvw
1 Header
xyz
ght
5 Trailer
reereqwe
fdsr
gresd
hrhfb
gegs

********************EOF****************
I want my out file should contain two blocks starting with 1 till the end 5

that is the output should contain
1 header
efgh
ijk
lmn
opq
5 Trailer
1 Header
xyz
ght
5 Trailer


It should omit the records between two blocks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jul 09, 2009 11:45 pm
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),
    END=(1,1,CH,EQ,C'5'),PUSH=(81:ID=1))
  OUTFIL INCLUDE=(81,1,CH,NE,C' '),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
POOJA KHADE

New User


Joined: 28 Dec 2006
Posts: 15
Location: mumbai

PostPosted: Fri Jul 10, 2009 1:25 am
Reply with quote

Thanks Frank for the quick help...
i tried the same code but it is abending with Syntax error for inrec..
Can you please check it...

Thank you
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 10, 2009 1:35 am
Reply with quote

Pooja Khade,

suggest you post the error messages with code tags for Frank.

Possibly you do not have the latest DFSOR PTF. I see that the GROUP keyword is used. could be the problem.

but you have to post the JES output of DFSORT so that he can verify
your version - as well as your copy of the code.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 10, 2009 1:48 am
Reply with quote

Quote:
Possibly you do not have the latest DFSORT PTF. I see that the GROUP keyword is used. could be the problem.


Or perhaps you're not using DFSORT at all. Please do post the //SYSOUT messages.
Back to top
View user's profile Send private message
POOJA KHADE

New User


Joined: 28 Dec 2006
Posts: 15
Location: mumbai

PostPosted: Fri Jul 10, 2009 2:01 am
Reply with quote

IGD103I SMS ALLOCATED TO DDNAME SORTIN
IGD103I SMS ALLOCATED TO DDNAME SORTOUT
IEF237I JES3 ALLOCATED TO SYSIN
IEC130I SORTMSG DD STATEMENT MISSING
WER268A VS90455C,JOBSTEP , -INREC STATEMENT : SYNTAX ERROR
WER211B VS90455C,JOBSTEP , -SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I VS90455C,JOBSTEP , -SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
IEF472I VS90455C JOBSTEP - COMPLETION CODE - SYSTEM=000 USER=0016 REASON=0000000
IEF285I VS90455.VS90455C.JOB38610.D000000A.? SYSOUT
IEF285I VS90455.VS90455C.JOB38610.D000000B.? SYSOUT
IGD104I VS90455.TEST.SORT RETAINED, DDNAME=SORTIN
Back to top
View user's profile Send private message
knarayan

New User


Joined: 25 Nov 2008
Posts: 9
Location: providence, ri

PostPosted: Fri Jul 10, 2009 2:28 am
Reply with quote

that is syncsort.. not sure if syncsort supports the when=group
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jul 10, 2009 2:48 am
Reply with quote

Hello,

The current release of Syncsort supports WHEN=GROUP. . .
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jul 10, 2009 7:46 pm
Reply with quote

Hello,

You might want to try this if you dont have the latest version installed.
Code:
//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN= input  file (FB/LRECL=80)                       
//SORTOUT  DD DSN= output file (FB/LRECL=80)                       
//SYSIN    DD *                                                   
 OPTION COPY                                                       
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),               
       IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),                             
       OVERLAY=(81:SEQNUM,8,ZD,INCR=2)),                           
       IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),                             
       OVERLAY=(81:SEQNUM,8,ZD,INCR=2)),                           
       IFTHEN=(WHEN=NONE,                                         
       OVERLAY=(89:SEQNUM,8,ZD,81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8)
 OUTREC OVERLAY=(89:81,8,ZD,MOD,+2,M11,LENGTH=8)                   
 OUTFIL BUILD=(1,80),OMIT=(89,8,ZD,EQ,0)                           
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top