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

How to change the column position dynamically in SYNCTOOL


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

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Thu Jan 10, 2008 8:54 pm
Reply with quote

In my JOB I have two input files and a output file for example:

INPUT FILE 1

Code:

pl1  Chandrashekar Sundaram
pl2  Kannan velusamy
pm1  Vijayabharathi Venkatesan
ao1  Vijayabhushan Devapooja


INPUT FILE 2

Code:

pl1   GM-VIP
pl1   PROJECT LEAD
pm1   GM
pm1   PROJECT MANAGER
ao1   GM-VIP
ao1   APPLICATION OWNER
ao1   CLIENT : GM


OUTPUT FILE

Code:

A45  Chandrashekar Sundaram     GM-VIP     PROJECT LEAD
A78  Vijayabharathi Venkatesan  GM         PROJECT MANAGER
A56  Vijayabhushan Devapooja    GM-VIP     APPLICATION OWNER  CLIENT : GM



I am using the following JOB for creating this OUTPUT FILE:

Code:

//S1    EXEC  PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//CON     DD *
pl1  Chandrashekar Sundaram
pl2  Kannan velusamy
pm1  Vijayabharathi Venkatesan
ao1  Vijayabhushan Devapooja
/*
//       DD *
pl1   GM-VIP
pl1   PROJECT LEAD
pm1   GM
pm1   PROJECT MANAGER
ao1   GM-VIP
ao1   APPLICATION OWNER
ao1   CLIENT : GM

/*
//T1     DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2     DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT    DD DSN=MZK10Q.TEST.FILE2,
//          DISP=(,CATLG,CATLG),
//          UNIT=TEMP,
//          SPACE=(TRK,(3))
//TOOLIN DD *
   SORT FROM(CON) TO(T1) USING(CTL1)
   SPLICE FROM(T1) TO(T2) ON(1,3,CH) -
   WITHEACH WITH(35,20) WITH(55,20) WITH(75,20)
   SORT FROM(T2) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  OPTION EQUALS
  INREC OVERLAY=(509:SEQNUM,8,ZD)
  SORT FIELDS=(1,3,CH,A)
  OUTREC IFTHEN=(WHEN=INIT,
      OVERLAY=(501:SEQNUM,8,ZD,RESTART=(1,3))),
    IFTHEN=(WHEN=(501,8,ZD,EQ,+2),BUILD=(1,3,35:7,20,501:501,16)),
    IFTHEN=(WHEN=(501,8,ZD,EQ,+3),BUILD=(1,3,55:7,20,501:501,16)),
    IFTHEN=(WHEN=(501,8,ZD,EQ,+4),BUILD=(1,3,75:7,20,501:501,16))
/*
//CTL2CNTL DD *
      SORT FIELDS=(509,8,ZD,A)
/*


Now my problem here is that the Key values in the INPUT FILE 2 for example 'ao1' can repeat N number of times.For example if i add a record
"ao1 SHIFT : MORNING" in INPUT FILE 2 then the existing JOB will not be able to append 'SHIFT : MORNING' to 'ao1' key record in the OUTPUT FILE.
Everytime I have to add a condition like this
IFTHEN=(WHEN=(501,8,ZD,EQ,+5),BUILD=(1,3,95:7,20,501:501,16))
to handle this situation.

How can i avoid this? Can I change the column position and increment counter (bolded above) dynamically to avoid it? Or is there any other way.....please suggest
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 Jan 10, 2008 10:19 pm
Reply with quote

If you wanted to make it more automatic, you could have the job determine the maximum number of repetitions automatically and generate the corresponding WITH operands and IFTHEN clauses accordingly. But it would probably be easier to just code the WITH operands and IFTHEN clauses for the maximum number of repetitions you'd expect (e.g. 10).
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Thu Jan 10, 2008 10:48 pm
Reply with quote

Frank Yaeger wrote:
If you wanted to make it more automatic, you could have the job determine the maximum number of repetitions automatically and generate the corresponding WITH operands and IFTHEN clauses accordingly.


Can you please explain the above mentioned quote by you with the help of some JOB code.....
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: Fri Jan 11, 2008 3:28 am
Reply with quote

I don't know where the 'A45' etc in your output file comes from, but going with the DFSORT/ICETOOL job you show, here's how you could modify it to generate and use the correct number of WITH and IFTHEN clauses. If you want to see what I'm "generating", use DFSORT copy to display &&CTL2CNTL, &&WITH and &&IF.

Code:

//S0    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN2 DD DSN=...  input file2
//CTL2CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//ONE DD *
ONE RECORD
/*
//WITH DD DSN=&&WITH,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//IF DD DSN=&&IF,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//TOOLIN DD *
COPY FROM(IN2) USING(CTL1)
COPY FROM(ONE) USING(CTL2)
/*
//CTL1CNTL DD    *
  INREC BUILD=(1,3,4:C'01')
  SORT FIELDS=(1,3,CH,A)
  OPTION ZDPRINT
  SUM FIELDS=(4,2,ZD)
 OUTFIL FNAMES=CTL2CNTL,REMOVECC,NODETAIL,BUILD=(80X),
  TRAILER1=(' OPTION COPY ',/,
   ' OUTFIL FNAMES=WITH,REPEAT=',
   MAX=(4,2,ZD,TO=ZD,LENGTH=2),',',/,
   '  BUILD=(C''  WITH(''',
   ',SEQNUM,4,ZD,START=35,INCR=20,C'',20)-'',80:X)',/,
   ' OUTFIL FNAMES=IF,REPEAT=',
     MAX=(4,2,ZD,TO=ZD,LENGTH=2),',',/,
   '  BUILD=(C''  IFTHEN=(WHEN=(501,8,ZD,EQ,''',
   ',SEQNUM,2,ZD,START=2,',/,
   '  C''),BUILD=(1,3,'',SEQNUM,4,ZD,START=35,INCR=20,',/,
   '  C'':7,20,501:501,16)),'',80:X)')
/*
//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//CON     DD DSN=...  input file1
//        DD DSN=...  input file2
//T1     DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2     DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT    DD DSN=...   output file
//TOOLIN DD *
SORT FROM(CON) TO(T1) USING(CTL1)
SPLICE FROM(T1) TO(T2) ON(1,3,CH) -
/*
//       DD DSN=&&WITH,DISP=(OLD,PASS)
//       DD *
   WITHEACH
SORT FROM(T2) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  OPTION EQUALS
  INREC OVERLAY=(509:SEQNUM,8,ZD)
  SORT FIELDS=(1,3,CH,A)
  OUTREC IFTHEN=(WHEN=INIT,
      OVERLAY=(501:SEQNUM,8,ZD,RESTART=(1,3))),
/*
//       DD DSN=&&IF,DISP=(OLD,PASS)
//       DD *
  IFOUTLEN=516
/*
//CTL2CNTL DD *
  SORT FIELDS=(509,8,ZD,A)
/*
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Fri Jan 11, 2008 6:05 pm
Reply with quote

oh i am sorry actually the OUTPUT FILE is

Code:
pl1    Chandrashekar Sundaram     GM-VIP     PROJECT LEAD
pm1  Vijayabharathi Venkatesan  GM         PROJECT MANAGER
ao1   Vijayabhushan Devapooja    GM-VIP     APPLICATION OWNER  CLIENT : GM
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Fri Jan 11, 2008 6:27 pm
Reply with quote

Hi Frank i tried the above code you posted but it is abending with the following message:

Code:
ABENDED S000 U0016


In Spool I found:

Code:
WER271A  OUTFIL STATEMENT  : NUMERIC FIELD ERROR
WER271A  OUTFIL STATEMENT  : NUMERIC FIELD ERROR


I am not able to rectify that please see what is the problem and rectify it
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Fri Jan 11, 2008 6:47 pm
Reply with quote

I think this info from spool can help:

Code:

CTL2CNTL :
 OPTION COPY
 OUTFIL FNAMES=WITH,REPEAT=01,
                           *
  BUILD=(C'  WITH(',SEQNUM,4,ZD,START=35,INCR=20,C',20)-',80:X)
 OUTFIL FNAMES=IF,REPEAT=01,
                         *
  BUILD=(C'  IFTHEN=(WHEN=(501,8,ZD,EQ,',SEQNUM,2,ZD,START=2,
  C'),BUILD=(1,3,',SEQNUM,4,ZD,START=35,INCR=20,
  C':7,20,501:501,16)),',80:X)
WER428I  CALLER-PROVIDED IDENTIFIER IS "0002"
WER903I  SYNCSORT 1.2.1.0 IS NOT LICENSED FOR SERIAL 6FE80, TYPE 2096 X03,
WER903I  SYNCSORT WILL STOP WORKING IN  39 DAYS UNLESS A VALID KEY IS INSTA
WER271A  OUTFIL STATEMENT  : NUMERIC FIELD ERROR
WER271A  OUTFIL STATEMENT  : NUMERIC FIELD ERROR
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: Fri Jan 11, 2008 9:50 pm
Reply with quote

rajatbagga,

My job works fine with DFSORT. However, the WER messages indicate you're using Syncsort, not DFSORT.

I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Fri Jan 11, 2008 10:01 pm
Reply with quote

No problem Frank... You have already helped me a lot by giving your wonderfull idea for solving this problem, I will try to use this code with DFSORT... Thank you very much again
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top