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 

Serial Numbering

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


Joined: 15 Jul 2004
Posts: 95
Topics: 11
Location: Edison,NJ

PostPosted: Tue Sep 28, 2004 11:28 am    Post subject: Serial Numbering Reply with quote

I have records in the format.

RecKey1-001--data
Reckey1-002--data
Reckey1-003--data
Reckey1-004--data
.....
Reckey2-001--data
Reckey2-002--data

I want to reserialize the input file to be

RecKey1-004--data1
Reckey1-003--data2
Reckey1-002--data3
Reckey1-001--data4
.....
Reckey2-002--data5
Reckey2-001--data6

Any short way to do other than cobol program ?
_________________
Vivek,NJ

Db2,IDMS
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Sep 28, 2004 11:58 am    Post subject: Reply with quote

vivek,

The reversal of records is quite simple, but a starting the key from 1 fresh every time a key changes is a bit tricky. With DFSORT'S SPLICE operator it is quite easy to acheive the desired results. The latest version of syncsort also supports splice operator. check this link for the solution.

http://www.mvsforums.com/helpboards/viewtopic.php?t=2628&highlight=splice

You will be getting the MAX instead of MIN for every from the above link.

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
vivek
Beginner


Joined: 15 Jul 2004
Posts: 95
Topics: 11
Location: Edison,NJ

PostPosted: Tue Sep 28, 2004 12:18 pm    Post subject: Reply with quote

Quote:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RecKey1-001--data
Reckey1-002--data
Reckey1-003--data
Reckey1-004--data
Reckey2-001--data
Reckey2-002--data
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(4,4,CH,A,9,3,CH,D)
OUTREC FIELDS=(1,17,SEQNUM,1,ZD)
/*


Frank, see the corrected input. the -001- serial numbering should be in descending order for Reckey1
have records in the format.

RecKey1-001--data1
Reckey1-002--data2
Reckey1-003--data3
Reckey1-004--data4
.....
Reckey2-001--data1
Reckey2-002--data2

I want to reserialize the input file to be

RecKey1-004--data1
Reckey1-003--data2
Reckey1-002--data3
Reckey1-001--data4
.....
Reckey2-002--data5
Reckey2-001--data6

will your step still work for this ?
_________________
Vivek,NJ

Db2,IDMS
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vivek
Beginner


Joined: 15 Jul 2004
Posts: 95
Topics: 11
Location: Edison,NJ

PostPosted: Tue Sep 28, 2004 12:21 pm    Post subject: Reply with quote

One more Question
this is my JCL

//PSTEP01 EXEC PGM=SORT
//SORTIN DD DSN=FM.FAMSTAT.FACTS.EXTRACT.FJ,DISP=SHR
//SORTOUT DD DSN=JUFACT.CASSTAT.ALL,DISP=(NEW,CATLG),
// LABEL=(,SL),
// UNIT=(SYSDA,10),
// SPACE=(CYL,(10,10),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=16000)
//SORTWK01 DD SPACE=(CYL,(50,100)),UNIT=SYSDA
//SORTWK02 DD SPACE=(CYL,(50,100)),UNIT=SYSDA
//SORTWK03 DD SPACE=(CYL,(50,100)),UNIT=SYSDA
//SORTWK04 DD SPACE=(CYL,(50,100)),UNIT=SYSDA
//SYSOUT DD SYSOUT=*
//SYSIN DD *
* CHOOSE CASEKEY,REC-TYPE, REC-COUNT, CASE STATUS DATE, CASE STATUS CODE
* REC STATUS CODE , CASE STATUS REASON CODE.
INREC FIELDS=(1,13,14,1,15,4,23,8,31,2,58,1,59,2)


Input file is

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
MIDFJ00392396A00011996 1996030419960229000000M 122519960115JUMCR1 0000
MIDFJ00392396B000219961996022901..1996030419960304JUMCR1 A
MIDFJ00392396B000319961996072905..1996073019960730JUEVJ1 A52
MIDFJ00392396D00041996199603051403 14030000 14030000 CM
MIDFJ00392396D00051996199603051405 14050000 14050000 CM
MIDFJ00392396D00061996199603051411 14110000 14110000 CM
MIDFJ00392396D00071996199603150800A15020430P15020900ACM
MIDFJ00392396D00081996199604160800A15840000 15840900ACM
MIDFJ00392396D00091996199605140800A15840430P15840900ACM
MIDFJ00392396D00101996199605210800A15840000 15840900ACM
MIDFJ00392396D00111996199606040800A15840430P15840900ACM
MIDFJ00392396D00121996199607150800A25060000 25060900ACM
MIDFJ00392396D00131996199607290800A25060430P25060900ACM
MIDFJ00392396E001419960010941996022905199607291 00000000..............22C:18-2


somehow the output is blank though there are two B records.
Any suggestions ?
_________________
Vivek,NJ

Db2,IDMS
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Tue Sep 28, 2004 12:21 pm    Post subject: Reply with quote

Maybe I'm not understanding what's wanted, but I can get the requested output with this simple DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN             
//SYSOUT    DD  SYSOUT=*             
//SORTIN DD *                         
Reckey1-001--data                     
Reckey1-002--data                     
Reckey1-003--data                     
Reckey1-004--data                     
Reckey2-001--data                     
Reckey2-002--data                     
/*
//SORTOUT DD SYSOUT=*                 
//SYSIN    DD    *                   
  SORT FIELDS=(4,4,CH,A,9,3,CH,D)     
  OUTREC FIELDS=(1,17,SEQNUM,1,ZD)     
/*


SORTOUT has:

Code:

Reckey1-004--data1 
Reckey1-003--data2 
Reckey1-002--data3 
Reckey1-001--data4 
Reckey2-002--data5 
Reckey2-001--data6 

_________________
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
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Tue Sep 28, 2004 12:24 pm    Post subject: Reply with quote

Quote:

//SYSIN DD *
* CHOOSE CASEKEY,REC-TYPE, REC-COUNT, CASE STATUS DATE, CASE STATUS CODE
* REC STATUS CODE , CASE STATUS REASON CODE.
INREC FIELDS=(1,13,14,1,15,4,23,8,31,2,58,1,59,2)


That's can't be all of it - you're missing a SORT, MERGE or COPY statement.
_________________
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
vivek
Beginner


Joined: 15 Jul 2004
Posts: 95
Topics: 11
Location: Edison,NJ

PostPosted: Tue Sep 28, 2004 12:24 pm    Post subject: Reply with quote

The JCL Missed out few lines at the bottom.
here is full JCL and Input record is same.

//PSTEP01 EXEC PGM=SORT
//SORTIN DD DSN=FM.FAMSTAT.FACTS.EXTRACT.FJ,DISP=SHR
//SORTOUT DD DSN=JUFACT.CASSTAT.ALL,DISP=(NEW,CATLG),
// LABEL=(,SL),
// UNIT=(SYSDA,10),
// SPACE=(CYL,(10,10),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=16000)
//SORTWK01 DD SPACE=(CYL,(50,100)),UNIT=SYSDA
//SORTWK02 DD SPACE=(CYL,(50,100)),UNIT=SYSDA
//SORTWK03 DD SPACE=(CYL,(50,100)),UNIT=SYSDA
//SORTWK04 DD SPACE=(CYL,(50,100)),UNIT=SYSDA
//SYSOUT DD SYSOUT=*
//SYSIN DD *
* CHOOSE CASEKEY,REC-TYPE, REC-COUNT, CASE STATUS DATE, CASE STATUS CODE
* REC STATUS CODE , CASE STATUS REASON CODE.
INREC FIELDS=(1,13,14,1,15,4,23,8,31,2,58,1,59,2)
SORT FIELDS=(1,13,CH,A),STOPAFT=20000
INCLUDE COND=(14,1,CH,EQ,C'B')
/*
_________________
Vivek,NJ

Db2,IDMS
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Tue Sep 28, 2004 2:26 pm    Post subject: Reply with quote

When I ran the equivalent of your job with DFSORT, I got the two B records.

Post your //SYSOUT output.
_________________
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
vivek
Beginner


Joined: 15 Jul 2004
Posts: 95
Topics: 11
Location: Edison,NJ

PostPosted: Tue Sep 28, 2004 6:33 pm    Post subject: Reply with quote

frank, it is kinda weird to me.

i ran the job several times changing sysin card.
1. without inrec.
2. moved include before sort fields line and it worked fine. then moved include back to original place and it worked now. i am not sure why it didnt work first time.

coming to earlier problem,
using sort how do i generate sequence number for a group of keys like.

input
RecKey1-001--data1
Reckey1-002--data2
Reckey1-003--data3
Reckey1-004--data4

output i want is ( last record in the group should have 001 or any indicator for that matter )

RecKey1-004--data1
Reckey1-003--data2
Reckey1-002--data3
Reckey1-001--data4
_________________
Vivek,NJ

Db2,IDMS
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Sep 29, 2004 10:22 am    Post subject: Reply with quote

The order in which you specify the INCLUDE and INREC statements doesn't matter. The INCLUDE statement is always processed BEFORE the INREC statement. See the following for details on the order in which DFSORT statements and parameters are processed:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/FIGSTMTSEQ?SHELF=&DT=20031124143823&CASE=&ScrollTOP=FIGSTMTSEQ#FIGSTMTSEQ

I really don't understand what you're asking about the sequence numbers. Which field is the key? Which field is the sequence number you're talking about? Please explain in more detail what you're trying to do.
_________________
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
vivek
Beginner


Joined: 15 Jul 2004
Posts: 95
Topics: 11
Location: Edison,NJ

PostPosted: Thu Sep 30, 2004 11:14 am    Post subject: Reply with quote

Frank, looks like DFsort does outrec before outfil. where as sort does outfil before outrec or in otherwords you can have an outrec for each outfil.

Kolusu , anyway to have sum for separate outfils ? (in SyncSort)
_________________
Vivek,NJ

Db2,IDMS
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Thu Sep 30, 2004 11:50 am    Post subject: Reply with quote

Quote:
Frank, looks like DFsort does outrec before outfil. where as sort does outfil before outrec or in otherwords you can have an outrec for each outfil.


You have to distinguish between control statements and parameters on control statements.

The OUTREC control statement is processed AFTER the SORT statement, but BEFORE the OUTFIL control statement.

The OUTREC parameter on each OUTFIL control statement is processed AFTER the SORT control statement and the OUTREC control statement.

So the order is:

SORT statement
OUTREC statement
OUTFIL statements (with OUTREC parameter)

Quote:
anyway to have sum for separate outfils ?


You can use TOTAL in the TRAILERx parameter of the OUTFIL statements.
_________________
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