|
View previous topic :: View next topic
|
| Author |
Message |
krishan isharwal
New User
Joined: 25 Aug 2011 Posts: 7 Location: india
|
|
|
|
I have to use SEQNUM function to create a sequence in my output file. In the start command (START=1 ), i can use 1 (or any other value) to start the sequence. However, i have a requirement that i need this value from another file that is input to my this sort step. I am not sure how to achieve this. I have done this using ICETOOL, however i need to do this by SyncSORT only as ICETOOL is not allowed to be used.
My sort card:
SORT FIELDS=COPY
OUTREC FIELDS=(SEQNUM,8,BI,START=1,9,08) |
|
| Back to top |
|
 |
gylbharat
Active Member
.jpg)
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Hi....
Can you please post some sample input and output in code tags |
|
| Back to top |
|
 |
krishan isharwal
New User
Joined: 25 Aug 2011 Posts: 7 Location: india
|
|
|
|
| gylbharat wrote: |
Hi....
Can you please post some sample input and output in code tags |
Output :
sequence no field other field
1 5
2 6
3 7
4 8
so forth.. |
|
| Back to top |
|
 |
gylbharat
Active Member
.jpg)
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Still not clear on the requirement...
You want the sequence numbers in in columns? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
krishan,
If you want to format things for us to read, that is good, but use the Code button to preserve the formatting so we can actually see it.. please?
You have a confusion. SYNCSORT is develped by one company. ICETOOL by another. Many sites seem to "ALIAS" SYNCTOOL to ICETOOL, for whatever reason. It is SYNCTOOL that you are not allowed to use (for reasons unknown), not ICETOOL, which your site almost certainly does not have.
If you have achieved this in SYNCTOOL, please show us the card.
If you have attempted the same solution in SYNCSORT, please show us the card and the output messages/results which show it not working.
All of it Code'd, please. |
|
| Back to top |
|
 |
krishan isharwal
New User
Joined: 25 Aug 2011 Posts: 7 Location: india
|
|
|
|
SORT FIELDS=COPY
OUTREC FIELDS=(SEQNUM,8,BI,START=1,9,08)
This is the sort card i am using ( for my testing right now ). From position 9 length 8 , i want to copy from my i/p file using 9,08)
From position 1 , i want a sequence no to be generated. The above sort card produces a result.
| Code: |
BI 1:8 BI 9:8
<---+----1----+----> <---+----1----+---->
**** Top of data ****
1 5
2 6
3 7
4 8
5 9
6 10
**** End of data **** . |
Now, i have harcoded the START=1 i.e it starts the sequence from 1. My requirement is that i need to start from a value which would come from another file. This i have to do using the syncsort |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Where is your SYNCTOOL solution, please? |
|
| Back to top |
|
 |
krishan isharwal
New User
Joined: 25 Aug 2011 Posts: 7 Location: india
|
|
|
|
| I have not tried this using SYNCTOOL. I need to do it using SYNCSORT. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| krishan isharwal wrote: |
[...]
I have done this using ICETOOL
[...] |
| krishan isharwal wrote: |
I have not tried this using SYNCTOOL
|
OK... so show us what you think is your ICETOOL solution that you mention in your first post. |
|
| Back to top |
|
 |
krishan isharwal
New User
Joined: 25 Aug 2011 Posts: 7 Location: india
|
|
|
|
| Code: |
//TOOLIN DD *
COPY FROM(COUNTER) TO(TEMPFIL) USING(CTL1)
COPY FROM(INFILE) TO(OUTFILE) USING(CTL2)
//*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=(1,5,CH,EQ,C'ARRID'),
BUILD=(4:C'START=',20,13,ZD,ADD,+1,TO=ZD,LENGTH=13,
C',INCR=1))',80:X))
INCLUDE COND=(1,5,CH,EQ,C'ARRID')
/*
//CTL2CNTL DD *
INREC IFTHEN=(WHEN=(1,8,CH,EQ,C' '),
OVERLAY=(1:SEQNUM,8,BI,
/*
// DD DSN=*.TEMPFIL,VOL=REF=*.TEMPFIL,
// DISP=(OLD,PASS) |
|
|
| Back to top |
|
 |
krishan isharwal
New User
Joined: 25 Aug 2011 Posts: 7 Location: india
|
|
|
|
same functionality i have to do with syncsort
| krishan isharwal wrote: |
| Code: |
//TOOLIN DD *
COPY FROM(COUNTER) TO(TEMPFIL) USING(CTL1)
COPY FROM(INFILE) TO(OUTFILE) USING(CTL2)
//*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=(1,5,CH,EQ,C'ARRID'),
BUILD=(4:C'START=',20,13,ZD,ADD,+1,TO=ZD,LENGTH=13,
C',INCR=1))',80:X))
INCLUDE COND=(1,5,CH,EQ,C'ARRID')
/*
//CTL2CNTL DD *
INREC IFTHEN=(WHEN=(1,8,CH,EQ,C' '),
OVERLAY=(1:SEQNUM,8,BI,
/*
// DD DSN=*.TEMPFIL,VOL=REF=*.TEMPFIL,
// DISP=(OLD,PASS) |
|
|
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| If it is SYNCSORT why did you post in DFSORT? Are you sure it was ICETOOL that you used and not SYNCTOOL - show your messages from that test - if they start WER then it is SYNCTOOL. |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
krishan isharwal,
| Quote: |
| However, i have a requirement that i need this value from another file that is input to my this sort step. |
May be I am not understanding the requirement but if you are trying to generate count based on "another file", what does that file look like? What is the LRECL and RECFM of the input file? I believe your input file will have just one record with the count. Please show content of the input file.
Thanks, |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Frank Yaeger showed a solution the other day, using SYMNAMES and a step to generate the SYMNAME that has the required value (this was a date).
I think that would work as a general approach. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
krishan isharwal,
You have already achieved what you want using a SYNCTOOL step. If you are not allowed (or some stupid at your shop is not willing) to implement SYNCTOOL in production, you can very well split your SYNCTOOL step into two Syncsort steps and achieve the same results. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| Many sites seem to "ALIAS" SYNCTOOL to ICETOOL, for whatever reason. |
Actually, Syncsort itself ships SYNCTOOL as an alias for ICETOOL. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Thanks, Frank, I didn't know that. That probably explains the prevalence of it that we see in these fora. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
krishan isharwal,
It would have shortened the process if you had included your SyncTOOL solution from the start, which is a working solution.
As Arun Raj has pointed out, you can do your SyncTOOL solution as a two-step SyncSORT solution.
I prefer the previously-mentioned SYMNAMES solution, as your sort cards are always visibly complete, and you have an element of "self-documentation" from the value being set to a name.
Up to you now. |
|
| Back to top |
|
 |
krishan isharwal
New User
Joined: 25 Aug 2011 Posts: 7 Location: india
|
|
|
|
| Arun Raj wrote: |
krishan isharwal,
You have already achieved what you want using a SYNCTOOL step. If you are not allowed (or some stupid at your shop is not willing) to implement SYNCTOOL in production, you can very well split your SYNCTOOL step into two Syncsort steps and achieve the same results. |
Could you please suggest hor to spilit this into two steps |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
krishan isharwal,
Splitting your Synctool step into two Syncsort steps would be as shown below.
| Code: |
//SORT01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN= Counter file
//SORTOUT DD DSN=&&T1,DISP=(,PASS),
// SPACE=(CYL,(1,5),RLSE)
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,5,CH,EQ,C'ARRID')
INREC IFTHEN=(WHEN=(1,5,CH,EQ,C'ARRID'),
BUILD=(4:C'START=',20,13,ZD,ADD,+1,TO=ZDF,LENGTH=13,
C',INCR=1))',80:X))
/*
//SORT02 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN= Input file
//SORTOUT DD DSN= Output file
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,8,CH,EQ,C' '),
OVERLAY=(1:SEQNUM,8,ZD,
/*
// DD DSN=*.SORT01.SORTOUT,VOL=REF=*.SORT01.SORTOUT,
// DISP=(OLD,PASS) |
|
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Bill Woodger wrote: |
I prefer the previously-mentioned SYMNAMES solution, as your sort cards are always visibly complete, and you have an element of "self-documentation" from the value being set to a name.
Up to you now. |
Hi Bill,
I ran a test and I see that the numeric subparameter value 'n' in the START=n can't be substituted by a numeric symbol. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|