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

SKIP/DELETE records only from a specific line


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Maharam

New User


Joined: 21 Feb 2015
Posts: 4
Location: USA

PostPosted: Wed Feb 25, 2015 3:30 am
Reply with quote

Hi,
I'm trying to do the following.
1. Copy the JCL from one PDS to other PDS.
2. Skip/delete the below lines when you copy over.
// DD DSN=TEST.DHL.RR46916,
// DISP=SHR
// DD DSN=TEST.DHL.RR46919,
// DISP=SHR
// DD DSN=TEST.DHL.RR46927,
// DISP=SHR
// DD DSN=TEST.DHL.RR46928,
// DISP=SHR

3. Replace the last two digits of the first DSN in the SORTIN DD of STEP10, using a symbolic parameter.
Letz say the symbolic parameter has a value 18.
Before change:
//SORTIN DD DSN=TEST.DHL.RR46903,
// DISP=SHR

After Change:
//SORTIN DD DSN=TEST.DHL.RR46918,
// DISP=SHR

Here is the Source JCL that i want to copy.
//STEP10 EXEC SORTD,
// CYLS=60
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TEST.DHL.RR46903,
// DISP=SHR
// DD DSN=TEST.DHL.RR46916,
// DISP=SHR
// DD DSN=TEST.DHL.RR46919,
// DISP=SHR
// DD DSN=TEST.DHL.RR46927,
// DISP=SHR
// DD DSN=TEST.DHL.RR46928,
// DISP=SHR
//SORTOUT DD DSN=&&RR469,
// DISP=(NEW,PASS,DELETE),
// DCB=(DSORG=PS,RECFM=FB,LRECL=16,BLKSIZE=0),
// SPACE=(CYL,(200,100),RLSE),
// UNIT=TEMPDISK
//SYSIN DD *
SORT FIELDS=(6,11,CH,A)
SUM FIELDS=NONE
/*
//STEP20 EXEC SORTD,
// CYLS=60
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TEST.DHL.RR277,
// DISP=SHR
//SORTOUT DD DSN=&&RR277,
// DISP=(NEW,PASS,DELETE),
// DCB=(DSORG=PS,RECFM=FB,LRECL=22,BLKSIZE=0),
// SPACE=(CYL,(200,100),RLSE)
//SYSIN DD *
SORT FIELDS=(10,11,CH,A)

/*

I was able to do step 1 and 3. Can anyone please help with step 2?

//STEP10 EXEC SORTD
//SORTIN DD DSN=TEST.PRIM.JCL(JPDS1),DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=TEST.SEC.JCL(JPDS2),DISP=SHR
//SYMNAMES DD *
OFFICE,C'18'
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,
FINDREP=(STARTPOS=37,ENDPOS=39,INOUT=(C'03',OFFICE)))
/*

How do i skip lines 6 to 13. Please help.
Back to top
View user's profile Send private message
Guest







PostPosted: Wed Feb 25, 2015 9:17 pm
Reply with quote

Hi Maharam,

Is the lines to be skipped always in lines 6 to 13
Back to top
Maharam

New User


Joined: 21 Feb 2015
Posts: 4
Location: USA

PostPosted: Wed Feb 25, 2015 11:43 pm
Reply with quote

Hi,
Thanks for looking into it. Yes, its always those lines(Unless there is a change in the JCL, which i hope wont be too often. icon_smile.gif)
I was thinking about doing that in two steps. Copy line 1 to 5 to a temp dataset 1 and line 14 to end to a temp dataset 2 and then concatenate both.

But i was looking for achieving it in single step. (I have to copy 50 similar JCLs. So if one takes 2 steps, then i have to code 100 steps for copying 50 JCLs. So tryinng to see if i could do that in one step.)
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: Thu Feb 26, 2015 1:36 am
Reply with quote

If the line-numbers will always be the same, you can append a sequence number temporarily and use OUTFIL OMIT= to get rid of the lines you don't want, and then BUILD to remove the temporary extension.
Back to top
View user's profile Send private message
Maharam

New User


Joined: 21 Feb 2015
Posts: 4
Location: USA

PostPosted: Thu Feb 26, 2015 9:38 pm
Reply with quote

Thank you, Bill!
I was able to do everything except the BUILD part to get rid of the extensions.

//SYSIN DD *
INREC OVERLAY=(72:SEQNUM,8,ZD)
SORT FIELDS=COPY
OUTFIL OMIT=((72,8,ZD,EQ,31),OR,(72,8,ZD,EQ,32),OR,
(72,8,ZD,EQ,33),OR,(72,8,ZD,EQ,34),OR,
(72,8,ZD,EQ,35),OR,(72,8,ZD,EQ,36),OR,
(72,8,ZD,EQ,37),OR,(72,8,ZD,EQ,38))
OUTREC IFTHEN=(WHEN=INIT,
FINDREP=(STARTPOS=37,ENDPOS=39,INOUT=(C'XX',OFFICE))),
IFTHEN=(WHEN=INIT,
FINDREP=(STARTPOS=01,ENDPOS=02,INOUT=(C'YY',OFFICE))),
IFTHEN=(WHEN=INIT,
FINDREP=(INOUT=(C'ABCD',REGION)))
/*

When i add BUILD=(1,72) after the OMIT, i'm adding the below error.
WER247A SORTOUT HAS INCOMPATIBLE LRECL

How do i maintain the LRECL 80 and get rid of the temporary seqnum from 72 to 80?
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: Thu Feb 26, 2015 10:03 pm
Reply with quote

Code:
  BUILD=(1,72,80:X)


That has your position one for a length of 72, puts a blank in position 80, and space-fills any intervening bytes. (1,72,8X), putting in eight blanks directly, would be the same.

You could also OVERLAY starting at 81. However, since you don't need the existing line-number data from the PDS member, you may as well re-use and then blank.

Try to use the Code tags when posting, to preserve spacing.
Back to top
View user's profile Send private message
Maharam

New User


Joined: 21 Feb 2015
Posts: 4
Location: USA

PostPosted: Thu Feb 26, 2015 10:24 pm
Reply with quote

Sure, Bill!
Thanks a lot for the code. It worked. icon_smile.gif Thanks again.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Write line by line from two files DFSORT/ICETOOL 7
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