|
|
| Author |
Message |
gpriyaeng
New User
Joined: 04 Jan 2008 Posts: 10 Location: hyderabad
|
|
|
|
Hi,
i have the following file.
23456
asdf
asd
asdfg
.2345
bhgh
ghjgfj
jfgj
jjgf
.4567
nbnhdf
mgmgf
mhmhk
i want an output like below.
0123456
02asdf
03asd
04asdfg
01.2345
02bhgh
03ghjgfj
04jfgj
05jjgf
01.4567
02nbnhdf
03mgmgf
04mhmhk
whenever the first byte is x'.', the sequence number should be re-initialized and start from 1....
how can this be done using syncsort. Please clarify |
|
| Back to top |
|
 |
References
|
Posted: Mon Jan 07, 2008 3:55 pm Post subject: Re: inserting sequence numbers using syncsort |
 |
|
|
 |
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1482 Location: Bangalore,India
|
|
|
|
Priya,
| Quote: |
| whenever the first byte is x'.', the sequence number should be re-initialized |
Show correct i/p and o/p? |
|
| Back to top |
|
 |
gpriyaeng
New User
Joined: 04 Jan 2008 Posts: 10 Location: hyderabad
|
|
|
|
| reinitialized means again start from 01, 02, 03...in the example i have taken a 2 byte sequence number.. |
|
| Back to top |
|
 |
guptae
Moderator
Joined: 14 Oct 2005 Posts: 990 Location: Bangalore,India
|
|
|
|
Hi There,
You can use following sort card
| Code: |
OPTION COPY
OUTREC FIELDS=(1:SEQNUM,2,ZD,3:1,80) |
Here I assume ur input record length as 80 U can change change it as per ur requirement.
Please let me know if you have any query regarding this. |
|
| Back to top |
|
 |
krisprems
Senior Member
Joined: 27 Nov 2006 Posts: 627 Location: India
|
|
|
|
| Code: |
//*****************************************************
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
23456
ASDF
ASD
ASDFG
.2345
BHGH
GHJGFJ
JFGJ
JJGF
.4567
NBNHDF
MGMGF
MHMHK
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,2,ZD)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'.'),
OVERLAY=(81:SEQNUM,2,ZD)),
IFTHEN=(WHEN=(1,1,CH,NE,C'.'),
OVERLAY=(89:SEQNUM,2,ZD,
81:81,2,ZD,SUB,89,2,ZD,M11,LENGTH=2))
OUTREC IFTHEN=(WHEN=INIT,BUILD=(1:SEQNUM,2,ZD,RESTART=(81,2),3:1,78))
/*
|
|
|
| Back to top |
|
 |
Anuj D.
Senior Member
Joined: 22 Apr 2006 Posts: 1701 Location: Mumbai, India
|
|
|
|
Hello,
Murali is saying that one of the record (23456) from you input shown does not have any dot ( "." ), what sequence no. should be there for this in output. |
|
| Back to top |
|
 |
gpriyaeng
New User
Joined: 04 Jan 2008 Posts: 10 Location: hyderabad
|
|
|
|
Thanks Krisprems.
can u explain the 3rd and 4th sysin card?
Thanks.
Gpriya |
|
| Back to top |
|
 |
krisprems
Senior Member
Joined: 27 Nov 2006 Posts: 627 Location: India
|
|
| Back to top |
|
 |
|
|
|