MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Copying every 100th record using SYNCSORT.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Jan 31, 2006 10:19 am    Post subject: Copying every 100th record using SYNCSORT. Reply with quote

Hi,

Can you give me a Syncsort JCL to copy every 100th record out of a huge file (Contains 20,000,000 records).

Thanks in advance.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Jan 31, 2006 10:53 am    Post subject: Reply with quote

ranga_subham,

Try this.


Code:

//SYSIN    DD *
  SORT FIELDS=COPY                 
  OUTREC FIELDS=(1,LRECL,SEQNUM,2,ZD)   
  OUTFIL INCLUDE=(LRECL+1,2,ZD,EQ,0),
  OUTREC=(1,LRECL)     
/*     

LRECL = YOUR FILE TOTAL LRECL (EX:  80)
LRECL + 1 = YOUR LRECL + 1 BYTE (EX: 81)



Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Tue Jan 31, 2006 11:45 pm    Post subject: Not working in Syncsort. Reply with quote

Hi Kolusu,

I tried the solution you've given. It gave me these errors.

SYSIN :
SORT FIELDS=COPY
OUTREC FIELDS=(1,LRECL,SEQNUM,2,ZD)
*
OUTFIL INCLUDE=(LRECL+1,2,ZD,EQ,0),
*
OUTREC=(1,LRECL)
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

We are using "SYNCSORT FOR Z/OS 1.1DR TPF3A"

Any other way around?
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Jan 31, 2006 11:54 pm    Post subject: Reply with quote

Hi,

The solution did not work. Is it for DFSORT or SYNCSORT?

If you happen to correct the solution what you've provided here earlier, can you pls make in a generic one. Why because, somebody may want to copy every nth record !!!

Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
pzmohanty
Beginner


Joined: 20 May 2004
Posts: 97
Topics: 43
Location: hyderabad, India

PostPosted: Wed Feb 01, 2006 5:04 am    Post subject: Reply with quote

Hi,
currently I don't have any idea , how we can accomplish this in a single step, but we can do this in two steps .

USING SORT
==========
Step 1 :

SORT FIELDS=COPY
OUTREC FIELDS=(1,17,SEQNUM,3,ZD)

Step 2:

SORT FIELDS=COPY
OUTREC FIELDS=(1,17,(18,3,ZD,SUB,((18,3,ZD,DIV,+2),MUL,+2)),ZD)
OUTFIL FILES=1,INCLUDE=(18,15,ZD,EQ,0)


We can also do it using File-Aid Batch : (in single step)
=================================

//STEP001 EXEC PGM=FILEAID
//SYSIN DD *
$$DD01 COPY SELECT=n
//DD01 DD DSN='UR.INPUT.DATASET.NAME'
//DD01O DD DSN='UR.OUTPUT.DATASET.NAME'
// DISP=(NEW,CATLG,DELETE),
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Feb 01, 2006 5:16 am    Post subject: Reply with quote

Quote:

Hi Kolusu,

I tried the solution you've given. It gave me these errors.



Mf_user,

Did you read my post my clearly Evil or Very Mad ? if you read it you would have found this.

Quote:

LRECL = YOUR FILE TOTAL LRECL (EX: 80)
LRECL + 1 = YOUR LRECL + 1 BYTE (EX: 81)



You need to supply the ACTUAL lrecl of the file in place of LRECL verb in the sysin cards

i.e if your file has an lrecl of 80 then your sysin cards should be as follows
Quote:

//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,80,SEQNUM,2,ZD)
OUTFIL INCLUDE=(81,2,ZD,EQ,0),
OUTREC=(1,80)
/*


Pay attention to the solutions provided and then learn how they are used.

Kolusu

Ranga_subham,

Quote:

If you happen to correct the solution what you've provided here earlier, can you pls make in a generic one. Why because, somebody may want to copy every nth record !!!


The solution works for both DFSORT and Syncsort.

Quote:

currently I don't have any idea , how we can accomplish this in a single step, but we can do this in two steps


Pzmohanty,

you do not need 2 steps to achieve this.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pzmohanty
Beginner


Joined: 20 May 2004
Posts: 97
Topics: 43
Location: hyderabad, India

PostPosted: Wed Feb 01, 2006 5:19 am    Post subject: Reply with quote

Hi ,

In my previous post
Quote:

Step 2:

SORT FIELDS=COPY
OUTREC FIELDS=(1,17,(18,3,ZD,SUB,((18,3,ZD,DIV,+2),MUL,+2)),ZD)
OUTFIL FILES=1,INCLUDE=(18,15,ZD,EQ,0)


Replace +2 by +n , to select every n records ..

The previous example extracts every 2nd record.
_________________
Priya Ranjan Mohanty
Consultant
Kanbay Software (I) pvt. Ltd.
Hyderabad
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
pzmohanty
Beginner


Joined: 20 May 2004
Posts: 97
Topics: 43
Location: hyderabad, India

PostPosted: Wed Feb 01, 2006 5:38 am    Post subject: Reply with quote

Hi Kolusu ,

Quote:

//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,80,SEQNUM,2,ZD)
OUTFIL INCLUDE=(81,2,ZD,EQ,0),
OUTREC=(1,80)
/*


The above control card will work only if I need every 100th record , but what I am trying to achieve is to have a control card which extracts every 'N'th record
_________________
Priya Ranjan Mohanty
Consultant
Kanbay Software (I) pvt. Ltd.
Hyderabad
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Wed Feb 01, 2006 6:30 am    Post subject: Reply with quote

Yes Kolusu. Sorry. That was my mistake only. Sad

Anyway, how to make it generic? Suppose, it somebody wants to copy every 49th record or every 82nd record.....in this case !!??

Thanks a lot for the details.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Feb 01, 2006 8:53 am    Post subject: Reply with quote

Quote:

Anyway, how to make it generic? Suppose, it somebody wants to copy every 49th record or every 82nd record.....in this case !!??

ranga_subham,

Here is a generic JCL which can used to copy any 'n'th record.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=YOUR INPUT DSN,                         
//            DISP=SHR                                         
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC FIELDS=(1,lrecl,                                         
                SEQNUM,8,ZD)                                   
  OUTREC FIELDS=(1,lrecl,                                         
                 lrecl+1,8,ZD,SUB,(lrecl+1,8,ZD,DIV,+n),MUL,+n,EDIT=(TTTTTTTT))
  OUTFIL INCLUDE=(lrecl+1,8,ZD,EQ,0),
  OUTREC=(1,lrecl)                               
/*   
lrecl   = Your actual file total recl(EX:  80)
lrecl+1 = YOUR actual file lrecl +1 Byte (EX: 81)
n       = your 'n'th record to be copied ex: 100 or 49


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Wed Feb 01, 2006 9:10 am    Post subject: copying GDG versions from old to latest using Syncsort !!?? Reply with quote

Wow.......thanks a lot.........so great of you.

May I ask this question to you. Surprised Arrow

Is it possible to copy the GDG versions in a reverse way (old first and latest last) into a flat file using the Syncsort Question Question
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Feb 01, 2006 9:31 am    Post subject: Reply with quote

Quote:

May I ask this question to you.

Is it possible to copy the GDG versions in a reverse way (old first and latest last) into a flat file using the Syncsort


Please search before posting. check this link

http://mvsforums.com/helpboards/viewtopic.php?t=2109&highlight=gdg+intrdr

Just change the step0300 to the following

Code:

//STEP0300 EXEC  PGM=SORT                       
//SYSOUT   DD SYSOUT=*                           
//SORTOUT  DD SYSOUT=*                           
//SORTIN   DD DATA,DLM=$$                       
//TIDXXXXA JOB 'PGM',                           
//             CLASS=A,                         
//             MSGCLASS=Y,                       
//             MSGLEVEL=(1,1),                   
//             NOTIFY=TID                       
//*                                             
//STEP0100 EXEC  PGM=SORT                     
//SYSOUT   DD SYSOUT=*                           
//SORTOUT  DD DSN=YOUR OUTPUT SEQ FILE,             
//            DISP=(NEW,CATLG,DELETE),           
//            UNIT=SYSDA,                       
//            SPACE=(CYL,(X,Y),RLSE)             
//SYSIN    DD *                             
  SORT FIELDS=COPY                           
//*                                         
$$                                               
//         DD DSN=&T1,DISP=(OLD,PASS)           
//         DD DSN=&T2,DISP=(OLD,PASS)           
//SYSIN    DD *                                 
  SORT FIELDS=COPY                               
//*                   


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Wed Feb 01, 2006 9:38 am    Post subject: Reply with quote

Yeah....I found that posting but did not understand what it does Embarassed
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Wed Feb 01, 2006 9:40 am    Post subject: Reply with quote

Thanks for the link......... Smile
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Feb 01, 2006 11:32 am    Post subject: Reply with quote

Quote:
Here is a generic JCL which can used to copy any 'n'th record.


For the record, you can do this more easily with DFSORT as shown below. n is the nth record. This works with any RECFM or LRECL.

Code:

//S1 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD DSN=...  input file   
//SORTOUT  DD DSN=...  output file                   
//SYSIN DD *                             
   SORT FIELDS=COPY                       
   OUTFIL STARTREC=n,SAMPLE=n         
/*                                       

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group