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 

Syncsort: Pass a value to Sysin
Goto page Previous  1, 2
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Sep 22, 2004 5:51 pm    Post subject: Reply with quote

Vivek,
You have older version of syncsort which does not support the DATE1 Parm. Here is an alternate way of doing it. As you are adverse to use synctool, I have to split the job into 3 steps.

A brief explanation of the job. STEP0100 writes out a single record with current date in the format CCYY/MM/DD. since we are using the report feature the recfm will be FBA

Now step0200 takes in the date file and creates a dynamic control card as follows.
Code:

 INCLUDE COND=(14,8,CH,EQ,C'20040922')     
 SORT FIELDS=COPY                           


Using this dynamic control card we select the desired records in step0300.


Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DUMMY,DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)     
//SORTOUT  DD DSN=&D,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE) 
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  OUTFIL HEADER1=(DATE=(4MD/))                             
/*
//STEP0200 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=&D,DISP=OLD                                   
//SORTOUT  DD DSN=&T,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE),RECFM=FB
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                               
  OUTFIL OUTREC=(C' INCLUDE COND=(14,8,CH,EQ,C',                 
                 C'''',                                           
                 02,4,                                             
                 07,2,                                             
                 10,2,                                             
                 C'''',                                           
                 C')',/,                                         
                 C' SORT FIELDS=COPY',/,                         
                 80:X)                                           
/*
//STEP0300 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR
//SORTOUT  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD DSN=&T,DISP=OLD   


Another alternative is to use DB2 to create the dynamic control cards.

Code:

//STEP0100 EXEC PGM=IKJEFT01                                 
//SYSTSPRT DD  SYSOUT=*,DCB=BLKSIZE=121                     
//SYSPRINT DD  SYSOUT=*                                     
//SYSTSIN  DD  *                                             
  DSN SYSTEM(XXXX)                                           
  RUN PROGRAM(DSNTIAUL) -                                   
      PLAN(DSNTIAUL)    -                                   
      PARMS('SQL')      -                                   
      LIB('DB2P.RUNLIB.LOAD')                               
//SYSREC00 DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)   
//SYSPUNCH DD DUMMY                                         
//SYSIN    DD  *                   
SELECT CHAR(' INCLUDE COND=(14,8,ZD,EQ,')   
      ,CHAR('C')                           
      ,CHAR('''')                           
      ,SUBSTR(CHAR(CURRENT DATE),1,4)       
      ,SUBSTR(CHAR(CURRENT DATE),6,2)       
      ,SUBSTR(CHAR(CURRENT DATE),9,2)       
      ,CHAR('''')                           
      ,CHAR(')  ')                         
       FROM SYSIBM.SYSDUMMY1               
;                                           
/*
//STEP0200 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR
//$ORTPARM DD * 
  OPTION COPY   
//SORTOUT  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD DSN=&T,DISP=OLD   


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: Thu Sep 23, 2004 12:39 am    Post subject: Reply with quote

Quote:

OUTFIL HEADER1=(DATE=(4MD/))


Does this mean a date format with date separator / ?
Quote:

OUTFIL OUTREC=(C' INCLUDE COND=(14,8,CH,EQ,C',
C'''',
02,4,
07,2,
10,2,
C'''',
C')',/,
C' SORT FIELDS=COPY',/,
80:X)


I am trying to under stand the syntax rules behind this
you say 02,04 , 07,2,10,2 does it mean starting at column 2 and length 4 , starting at 7 length 2, starting at 10 length 2 ? so column 1,5,9 will have the date separator ??
_________________
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: 12401
Topics: 75
Location: San Jose

PostPosted: Thu Sep 23, 2004 5:57 am    Post subject: Reply with quote

vivek,

Quote:

Does this mean a date format with date separator / ?


yes the date will be of format CCYY/MM/DD

Quote:

I am trying to under stand the syntax rules behind this you say 02,04 , 07,2,10,2 does it mean starting at column 2 and length 4 , starting at 7 length 2, starting at 10 length 2 ? so column 1,5,9 will have the date separator ??


You are partially correct. Let me explain it clearly. When you use a report feature like header or trailer then the sortout dataset is created with a carriage control character. Ofcourse the latest versions of sort can supress this carriage control character with REMOVECC parm.

so the output from step0100 will look like this
Code:

----+----1-
*2004/09/23


I used * to denote the carriage control character. Now your date format is CCYYMMDD. Look at the date generated above.

At pos 2 for 4 bytes you have the year.
At pos 7 for 2 bytes you have the month.
At pos 10 for 2 bytes you have the day

The / parm after the closing parenthesis is used to split the line and write a new line.

80:x means pad with spaces up to 80 bytes for rest of the bytes. Let us say SORT FIELDS=COPY occupies 17 bytes then starting from 18 th byte to 80th byte spaces are padded.

If you want to understand the control cards more then grab a manual and look at the OUTREC parm. You can also remove the temp datasets to catlg datasets and see how each step is working.

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: Thu Sep 23, 2004 9:10 am    Post subject: Reply with quote

kolusu,

thanks for the good and quick responses. in the following code the first two lines with an asterisk on the column 1 are treated as commentes and ignored by sort utility right ?

[Code:]
* SORT ASCENDING ON DOCKET AND DESCENDING ON DATE SO THAT LATEST REC
* WILL BE ON TOP
SORT FIELDS=(1,13,CH,A,14,8,CH,D)
[Code:]
_________________
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: 12401
Topics: 75
Location: San Jose

PostPosted: Thu Sep 23, 2004 9:45 am    Post subject: Reply with quote

vivek,

Quote:

the first two lines with an asterisk on the column 1 are treated as commentes and ignored by sort utility right ?


Yes they are treated as comments. Note that your actual sort control statements should NOT start in pos 1.

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


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Wed Jan 05, 2005 8:01 am    Post subject: Reply with quote

Hi Kolusu,
I am using your first post JCL with little modification in toolin as follows
Quote:

//TOOLIN DD *
COPY FROM(DATEIN) USING(CTL1)
COPY FROM(SORTIN) TO(SORTOUT) USING(CTL2)
//CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,
OUTREC=(C' INCLUDE COND=(37,2,CH,EQ,72,AND,
26,5,PD,GT,C',
C'''', $ OPENING QUOTE
20,8, $ DATE FROM PARM
C'''', $ CLOSING QUOTE
C')', $ CLOSING PARENTHESIS
10004:X) $ PAD SPACES TO 10004 BYTES
//CTL2CNTL DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(100,100),RLSE)

Toolin messages as follows
Quote:

SYT002I "TOOLIN" INTERFACE BEING USED
COPY FROM(DATEIN) USING(CTL1)
SYT020I SYNCSORT CALLED WITH IDENTIFIER "0001"
SYT012E SYNCSORT COMPLETED UNSUCCESSFULLY
SYT030I OPERATION COMPLETED WITH RETURN CODE 16

DFSMSG messages as follows
Quote:

WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT



I want compare with charecter 72 in include cond so can I change it to
Quote:

OUTREC=(C' INCLUDE COND=(37,2,CH,EQ,c''72'',AND,
26,5,PD,GT,C',


Please let me know what is problem here
_________________
Regards,
Chandra
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Jan 05, 2005 8:07 am    Post subject: Reply with quote

Chandra,

Make sure you have ATLEAST one space before all the instructions in the CONTROL card (OUTREC, OUTFIL ....).

Thanks,
Phantom
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Jan 05, 2005 8:09 am    Post subject: Reply with quote

Chandra,

Your control card should look like this.

Code:

//CTL1CNTL   DD  *
  OUTFIL FNAMES=(.....),
  OUTREC=(......)
/*


Note the blanks before the words OUTFIL and OUTREC.

Thanks,
Phantom
Back to top
View user's profile Send private message
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Thu Jan 06, 2005 12:25 am    Post subject: Reply with quote

Hi Phantom,

I have given one space after OUTFIL and OUTREC but still I am getting same error as mentioned above.
Quote:

/CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,
OUTREC= (C' INCLUDE COND=(37,2,CH,EQ,72,AND,
26,5,PD,GT,C',

_________________
Regards,
Chandra
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jan 06, 2005 1:35 am    Post subject: Reply with quote

Chandra,

In your OUTREC Statement below, you need to close the Quotes in every line. You cannot continue a Literal in more than one line like this.
Code:

OUTREC=(C' INCLUDE COND=(37,2,CH,EQ,72,AND,
26,5,PD,GT,C',


Change your OUTREC as shown below and let us know if you still get any problems.
Code:

  OUTREC=(C' INCLUDE COND=(37,2,CH,EQ,72,AND,',
                  C'26,5,PD,GT,C',


Note: You need to follow the procedure in all the lines. Start every line with a " C' " and end with a " ', ".

Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Thu Jan 06, 2005 11:06 pm    Post subject: Reply with quote

Hi Phantom,

It's working, thank you very much.
_________________
Regards,
Chandra
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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