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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort - How to use sort to copy selected blocks from file
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 Moderator


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

PostPosted: Thu Jul 09, 2009 11:45 pm    Post subject:
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    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Fri Jul 10, 2009 1:35 am    Post subject:
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 Moderator


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

PostPosted: Fri Jul 10, 2009 1:48 am    Post subject:
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    Post subject: error message
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    Post subject:
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

Site Director


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

PostPosted: Fri Jul 10, 2009 2:48 am    Post subject:
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: 2284
Location: @my desk

PostPosted: Fri Jul 10, 2009 7:46 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am


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