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 

Replace Spaces With Current Date
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Dinesh.G
Beginner


Joined: 18 Jan 2005
Posts: 9
Topics: 2

PostPosted: Tue Jan 18, 2005 2:08 pm    Post subject: Replace Spaces With Current Date Reply with quote

Hi,

I have an Input File which has Some records with Blanks(Spaces) in
the Date Field(CCCCMMYY). The Requirements is that I have to
replace the date Field having spaces with the Current Date.The
records having valid date values should be left untouched and
should remain intact in the output File.

Thanks & rgds
Dinesh

Ex:
Input File

    ----+----1---------+
    0001 20041210
    0004
    0007 20041110

    Output File:
    ----+----1---------+
    0001 20041210
    0004 20050118
    0007 20041110
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 18, 2005 2:48 pm    Post subject: Reply with quote

Dinesh,

Try this JCL. I assumed that your input file has the following attributes .Recfm=fb , lrecl=80

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                   
0001 20041210                                                     
0004                                                             
0007 20041110                                                     
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC FIELDS=(1,5,6,8,CHANGE=(8,C'        ',C'00000000'),       
                        NOMATCH=(6,8),                                     
                14,67,DATE1,                                       
                6,8,CHANGE=(8,C'        ',C'00000000'),           
                    NOMATCH=(C'REALDATE'))                             
  OUTREC FIELDS=(1,80,81:89,8,CHANGE=(8,C'REALDATE',C'00000000'), 
                              NOMATCH=(81,8))                                   
  OUTFIL OUTREC=(1,5,                                             
                 6,8,ZD,ADD,81,8,ZD,EDIT=(TTTTTTTT),               
                 14,67)                                           
/*                   


Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG   DD SYSOUT=*                                       
//DFSMSG    DD SYSOUT=*                                       
//IN        DD *                                               
0001 20041210                                                 
0004                                                           
0007 20041110                                                 
//TOOLIN    DD *                                               
  COPY FROM(IN)  USING(CTL1)                                   
  SORT FROM(CON) USING(CTL2)                                   
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)     
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)     
//CON      DD DSN=&T1,VOL=REF=*.T1,DISP=OLD                   
//         DD DSN=&T2,VOL=REF=*.T2,DISP=OLD                   
//OUT      DD SYSOUT=*                                         
//CTL1CNTL DD *                                               
  INREC FIELDS=(1,80,SEQNUM,8,ZD)                             
  OUTFIL FNAMES=T1,INCLUDE=(6,8,CH,EQ,C' '),                   
  OUTREC=(1,5,DATE1,14,75)                                     
  OUTFIL FNAMES=T2,SAVE                                       
//CTL2CNTL DD *                                               
  OPTION EQUALS                                               
  SORT FIELDS=(81,8,CH,A)                                     
  OUTFIL FNAMES=OUT,                                           
  OUTREC=(1,80)                                               
/*


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
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jan 18, 2005 4:22 pm    Post subject: Reply with quote

With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can do this more easily and efficiently with DFSORT's new IFTHEN and OVERLAY parameters as follows:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
0001 20041210
0004
0007 20041110
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(6,8,CH,EQ,C' '),OVERLAY=(6:DATE1))
/*


For complete details on all of the new DFSORT and ICETOOL functions available with these PTFs, see

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dinesh.G
Beginner


Joined: 18 Jan 2005
Posts: 9
Topics: 2

PostPosted: Tue Jan 18, 2005 6:36 pm    Post subject: Reply with quote

kolusu,

Thanks a Lot, but One more problem which forgot to mention was the
there are trailer records which will have the sequence no in the date field
The trailer record are denoted by 9 in the first byte and the detailed record are denoted by 5 in the first byte.I want to replace the
date field having spaces with the Current Date only for the detailed records and remaining records should be intact in o/p file.(The sequence No should appear as it is for the Trailer Record)

    Input File

    5N0J20050105
    5N0J20050105
    90007
    5N5A20050113
    5N0A
    90005
    5N5B20050113
    5N5B
    5N5B20050113
    90001


    Output File
    5N0J20050105
    5N0J20050105
    90007
    5N5A20050113
    5N0A20051801
    90005
    5N5B20050113
    5N5B20051801
    5N5B20050113
    90001



Thanks & Rgds
Dinesh
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 18, 2005 6:53 pm    Post subject: Reply with quote

Dinesh,

All you need is to change the include cond in the second jcl. try this job

Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG   DD SYSOUT=*                                       
//DFSMSG    DD SYSOUT=*                                       
//IN        DD *                                               
0001 20041210                                                 
0004                                                           
0007 20041110                                                 
//TOOLIN    DD *                                               
  COPY FROM(IN)  USING(CTL1)                                   
  SORT FROM(CON) USING(CTL2)                                   
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)     
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)     
//CON      DD DSN=&T1,VOL=REF=*.T1,DISP=OLD                   
//         DD DSN=&T2,VOL=REF=*.T2,DISP=OLD                   
//OUT      DD SYSOUT=*                                         
//CTL1CNTL DD *                                               
  INREC FIELDS=(1,80,SEQNUM,8,ZD)                             
  OUTFIL FNAMES=T1,INCLUDE=(1,1,CH,EQ,C'5',AND,6,8,CH,EQ,C' '),
  OUTREC=(1,5,DATE1,14,75)                                     
  OUTFIL FNAMES=T2,SAVE                                       
//CTL2CNTL DD *                                               
  OPTION EQUALS                                               
  SORT FIELDS=(81,8,CH,A)                                     
  OUTFIL FNAMES=OUT,                                           
  OUTREC=(1,80)                                               
/*


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
Dinesh.G
Beginner


Joined: 18 Jan 2005
Posts: 9
Topics: 2

PostPosted: Tue Jan 18, 2005 6:59 pm    Post subject: Reply with quote

Kolusu,

Is it possible to implement the logic by a single SORT CARD.(Sort pgm)as mentioned.

Rgds
Dinesh
Back to top
View user's profile Send private message Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jan 18, 2005 7:36 pm    Post subject: Reply with quote

Dinesh,

I don't know if you didn't see my post or just ignored it, but ...

Looking at your new input data and output data, it appears that you changed the requirements a little bit more than you mentioned. The date now starts in position 5 instead of position 6, and you show 20051801 as the current date which would be in the format yyyyddmm instead of yyyymmdd. Perhaps this was a mistake on your part since it doesn't seem to match the 20050113 date in your input file. And by "single SORT CARD.(Sort pgm)", I assume you mean a single pass over the data.

At any rate, whichever type of date you want, you can do this in a single copy pass with DFSORT as follows:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
5N0J20050105
5N0J20050105
90007
5N5A20050113
5N0A
90005
5N5B20050113
5N5B
5N5B20050113
90001
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
   OPTION COPY
   INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'5',AND,5,8,CH,EQ,C' '),
      OVERLAY=(5:DATENS=(4DM)))
/*


DATENS=(4DM) produces a 'yyyyddmm' date. If you want a 'yyyymmdd' date, you can use either DATE1 or DATENS=(4MD) instead of DATENS=(4DM).
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jan 19, 2005 9:25 am    Post subject: Reply with quote

Dinesh,

Take a look at the solution provided by frank. If you don't have DFSORT or you don't have the latest ptf installed then try this jcl

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
5N0J20050105                                                     
5N0J20050105                                                     
90007                                                           
5N5A20050113                                                     
5N0A                                                             
90005                                                           
5N5B20050113                                                     
5N5B                                                             
5N5B20050113                                                     
90001                                                           
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)       
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)       
//SYSIN    DD *                                                 
   SORT FIELDS=COPY                                               
   INREC FIELDS=(1,80,SEQNUM,8,ZD)                               
   OUTFIL FNAMES=T1,INCLUDE=(1,1,CH,EQ,C'5',AND,6,8,CH,EQ,C' '), 
   OUTREC=(1,4,DATENS=(4DM),13,76)
   OUTFIL FNAMES=T2,SAVE                                         
/*                                                               
//STEP0200 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=&T1,DISP=OLD                                   
//         DD DSN=&T2,DISP=OLD                                   
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
   OPTION EQUALS                                                 
   SORT FIELDS=(81,8,CH,A)                                       
   OUTREC FIELDS=(1,80)                                           
/*                               


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
Dinesh.G
Beginner


Joined: 18 Jan 2005
Posts: 9
Topics: 2

PostPosted: Wed Jan 19, 2005 2:02 pm    Post subject: Reply with quote

Thanks Kolusu & Frank for the Solution. One more query what should be approach if the Input file is in VB Format.The mentioned Jcl worked fine
for FB format File.When I tried for VB format File the Job abended.The Sysout stated like this

WER244A INREC - SHORT RECORD
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jan 19, 2005 3:31 pm    Post subject: Reply with quote

Dinesh,

Please follow the rules. Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.

We will post a detailed solution when you provide us the information

1. What is the LRECL,RECFM of the input/output datasets
2. What is the position of the date field in the file ( consider RDW)
3. Post all the conditions which need to be considered for updating the date.
4. Post a sample input and desired output

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jan 19, 2005 4:43 pm    Post subject: Reply with quote

The WER message indicates you're using Syncsort, so you won't be able to use the IFTHEN/OVERLAY method I posted since IFTHEN/OVERLAY is only available with DFSORT. Also, I don't answer questions on Syncsort.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dinesh.G
Beginner


Joined: 18 Jan 2005
Posts: 9
Topics: 2

PostPosted: Thu Jan 20, 2005 1:35 pm    Post subject: Reply with quote

HI Kolusu,
Here is my Requirements


I have an Input VB Format File which has detailed records and Trailer Records.The trailer record are denoted by 9 in the first byte and the detailed recordare denoted by 5 in the first byte.
There are Some detailed records with Blanks(Spaces)in the Date Field(YYYYMMDD).
The trailer records will have Some sequence no in the date field
The Requirements is that I have to replace the Detailed records with the date Field having spaces with the Current Date.
The Trailer records ,the Detailed records having valid date values should be left untouched and should remain intact in the output File.

The Input File Length=56, Record Format=VB
Date Field Positon starts from 10th Byte

Thanks & rgds
Dinesh

Ex:
Input File

Code:
----+----1----+----2----+----3----+----4----+----5---
5N0J2UCCA20050105371535615331002B02        D511:0001
5N0J2UCCA        371551437921003B02        D511:0001
5N0J2UCCA        371551443921005B02        D511:0001
5N0J2UCCA20050105371551444981008B02        D511:0001
9000000549
5N0J2UCCA20050105371551463981004B02        D511:0001
9000000547                                           
5N5M1NAQB        371270009104001BFJA5MXN18 D427:0001
5N5M1NAQB        371270009122003BFJA5MBD22 D427:0001
5N5M1NAQB20050113371270009251000BFJA5MEN24 D427:0001
9000000548     


Output File


Code:
----+----1----+----2----+----3----+----4----+----5---
5N0J2UCCA20050105371535615331002B02        D511:0001
5N0J2UCCA20050120371551437921003B02        D511:0001
5N0J2UCCA20050120371551443921005B02        D511:0001
5N0J2UCCA20050105371551444981008B02        D511:0001
9000000549
5N0J2UCCA20050105371551463981004B02        D511:0001
9000000547                                           
5N5M1NAQB20050120371270009104001BFJA5MXN18 D427:0001
5N5M1NAQB20050120371270009122003BFJA5MBD22 D427:0001
5N5M1NAQB20050113371270009251000BFJA5MEN24 D427:0001
9000000548         
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jan 20, 2005 2:05 pm    Post subject: Reply with quote

Dinesh,

Try this JCL

Code:

//STEP0100 EXEC PGM=SORT,PARM='VLTESTI=1' 
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=YOUR INPUT VB FILE,
//            DISP=SHR                                           
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)       
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)       
//SYSIN    DD *                                                 
   SORT FIELDS=COPY                                               
   INREC FIELDS=(1,4,SEQNUM,8,ZD,5)                               
   OUTFIL FNAMES=T1,INCLUDE=(13,1,CH,EQ,C'5',AND,22,8,CH,EQ,C' '), 
   OUTREC=(1,21,DATENS=(4DM),30)
   OUTFIL FNAMES=T2,SAVE                                         
/*                                                               
//STEP0200 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=&T1,DISP=OLD                                   
//         DD DSN=&T2,DISP=OLD                                   
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
   OPTION EQUALS                                                 
   SORT FIELDS=(5,8,CH,A)                                       
   OUTREC FIELDS=(1,4,13)                                           
/*   


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
Dinesh.G
Beginner


Joined: 18 Jan 2005
Posts: 9
Topics: 2

PostPosted: Thu Jan 20, 2005 3:14 pm    Post subject: Reply with quote

Thanks Kolusu, Thanks a lot....
The Sort Card worked Fine.

Rgds
Dinesh
Back to top
View user's profile Send private message Yahoo Messenger
Maheshwari
Beginner


Joined: 19 Oct 2004
Posts: 21
Topics: 3

PostPosted: Tue Jan 25, 2005 11:00 pm    Post subject: Reply with quote

Kolusu,

Can you please let me know about the parameter VLTESTI passed to SORT as I am not very much aware of this. I tried to find it in Google also but seems to have not much info available for this.

Thanks.
_________________
Amit
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 1, 2  Next
Page 1 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