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

Syncsort SEQNUM - Start value from a file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
krishan isharwal

New User


Joined: 25 Aug 2011
Posts: 7
Location: india

PostPosted: Thu Aug 25, 2011 12:53 pm
Reply with quote

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
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 25, 2011 12:58 pm
Reply with quote

Hi....

Can you please post some sample input and output in code tags
Back to top
View user's profile Send private message
krishan isharwal

New User


Joined: 25 Aug 2011
Posts: 7
Location: india

PostPosted: Thu Aug 25, 2011 2:23 pm
Reply with quote

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
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 25, 2011 2:37 pm
Reply with quote

Still not clear on the requirement...

You want the sequence numbers in in columns?
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 Aug 25, 2011 2:53 pm
Reply with quote

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
View user's profile Send private message
krishan isharwal

New User


Joined: 25 Aug 2011
Posts: 7
Location: india

PostPosted: Thu Aug 25, 2011 4:21 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 25, 2011 4:25 pm
Reply with quote

Where is your SYNCTOOL solution, please?
Back to top
View user's profile Send private message
krishan isharwal

New User


Joined: 25 Aug 2011
Posts: 7
Location: india

PostPosted: Thu Aug 25, 2011 4:41 pm
Reply with quote

I have not tried this using SYNCTOOL. I need to do it using SYNCSORT.
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 Aug 25, 2011 4:46 pm
Reply with quote

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
View user's profile Send private message
krishan isharwal

New User


Joined: 25 Aug 2011
Posts: 7
Location: india

PostPosted: Thu Aug 25, 2011 5:20 pm
Reply with quote

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
View user's profile Send private message
krishan isharwal

New User


Joined: 25 Aug 2011
Posts: 7
Location: india

PostPosted: Thu Aug 25, 2011 5:21 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Aug 25, 2011 5:56 pm
Reply with quote

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
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu Aug 25, 2011 6:27 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 25, 2011 8:10 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Aug 25, 2011 9:43 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Aug 25, 2011 11:35 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 26, 2011 3:53 am
Reply with quote

Thanks, Frank, I didn't know that. That probably explains the prevalence of it that we see in these fora.
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: Fri Aug 26, 2011 3:57 am
Reply with quote

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
View user's profile Send private message
krishan isharwal

New User


Joined: 25 Aug 2011
Posts: 7
Location: india

PostPosted: Fri Aug 26, 2011 11:18 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Aug 26, 2011 8:14 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Aug 26, 2011 8:28 pm
Reply with quote

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
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top