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 one digit with 4 digits
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
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Jan 07, 2010 1:16 pm    Post subject: replace one digit with 4 digits Reply with quote

Hi,

My input files looks like this - RECFM-FB, LRECL=80
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
12345XXX1238M1ZE5E76AF178398TRE111111ZZZ0006 0109323          M  AZK56     2 101
12345XXX1238M1ZE5E                                                         2 201
12345XXX1238M1ZE5E                                                         29401
12345XYZ1235L1FK1EJ2A9175944TRE111111ZZZ0006 0109323          M  AZK47     2 101
12345XYZ1235L1FK1E                                                         2 201
12345XYZ1235L1FK1E                                                         29401


The 41st position has a value "0". I want it to be replaced with "2010", current year. If the same JCL is used in 2020, the "0" should be replaced with "2020"........

Expected Output: RECFM-FB, LRECL-80
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
12345XXX1238M1ZE5E76AF178398TRE111111ZZZ2010006 0109323       M  AZK56     2 101
12345XXX1238M1ZE5E                                                         2 201
12345XXX1238M1ZE5E                                                         29401
12345XYZ1235L1FK1EJ2A9175944TRE111111ZZZ2010006 0109323       M  AZK47     2 101
12345XYZ1235L1FK1E                                                         2 201
12345XYZ1235L1FK1E                                                         29401


Pleaset le me know if this is achievable with SORT.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Thu Jan 07, 2010 2:04 pm    Post subject: Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD *
CURYR,S'&YR4'
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(41,1,CH,EQ,C'0'),
    BUILD=(1,40,41:CURYR,45:42,11,63:63,18))
/*

_________________
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
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Fri Jan 08, 2010 2:47 pm    Post subject: not working for other values Reply with quote

Hi, Frank.

Thank you very much for the quick reply. This solution is working only on value '0' in 41st position. How to modify it for other than '0' value in 41st position?

Input:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
12345XXX1238M1ZE5E76AF178398TRE111111ZZZ1006 0109323          M  AZK56     2 101
12345XXX1238M1ZE5E                                                         2 201
12345XXX1238M1ZE5E                                                         29401
12345XYZ1235L1FK1EJ2A9175944TRE111111ZZZ2006 0109323          M  AZK47     2 101
12345XYZ1235L1FK1E                                                         2 201
12345XYZ1235L1FK1E                                                         29401


Output:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
12345XXX1238M1ZE5E76AF178398TRE111111ZZZ2011006 0109323       M  AZK56     2 101
12345XXX1238M1ZE5E                                                         2 201
12345XXX1238M1ZE5E                                                         29401
12345XYZ1235L1FK1EJ2A9175944TRE111111ZZZ2012006 0109323       M  AZK47     2 101
12345XYZ1235L1FK1E                                                         2 201
12345XYZ1235L1FK1E                                                         29401


How to prefix only the first three digits of current year (201) in front of '0' or '1' or '2'? Is this possible?

Please help.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Fri Jan 08, 2010 5:39 pm    Post subject: Reply with quote

Quote:
This solution is working only on value '0' in 41st position.


Yes, that's what you asked for in your original post, so that's what I gave you.

Quote:
How to modify it for other than '0' value in 41st position?


Your changed requirement isn't clear. Do you want to check for only certain characters in 41? If so, you can use SS notation, e.g. to check for 0-2:

Code:

   WHEN=(41,1,SS,EQ,C'012'),


or do you want to check for any nonblank character in 41? If so, you can use:

Code:

  WHEN=(41,1,CH,NE,C' '),


or do you want something else? If so, what exactly?

Quote:
How to prefix only the first three digits of current year (201) in front of '0' or '1' or '2'? Is this possible?


You can use symbol subset notation for that:

Code:

//SYMNAMES DD *   
CURYR,S'&YR4(1:3)'


That will set CURYR to the first 3 characters of the current 4-digit year.
_________________
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
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Sun Jan 10, 2010 10:51 am    Post subject: using DFSORT v1.5 Reply with quote

Hi,

Thanks for the details. The info is really useful to me. I would like to know why the SYMNAMES with "CURYR,S'&YR4'" does not work with DFSORT v1.5? Why that restriction? It shows "$" sign right below the "S" character after job ends with MAXCC=16.

I also would like to know, after changing the value from "0006" to "2010006", how to convert it to "2010-01-06" using DFSORT v1.5?

Thanks for your patience.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Mon Jan 11, 2010 12:07 pm    Post subject: Reply with quote

S constants have been available with z/OS DFSORT V1R5 since April, 2006. So your site must be very behind in installing PTFs. Ask your System Programmer to install z/OS DFSORT V1R5 PTF UK51706 (Nov, 2009). That will get you up to date on all of the DFSORT functional PTFs.

Quote:
I also would like to know, after changing the value from "0006" to "2010006", how to convert it to "2010-01-06" using DFSORT v1.5?


Please show an example of your input records and what you expect for output for this requirement.
_________________
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
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Tue Jan 12, 2010 5:03 am    Post subject: input and output Reply with quote

Hi,

Below given are my input and expected output files.

Input:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
12345XXX1238M1ZE5E76AF178398TRE111111ZZZ2010006 0109323       M  AZK56     2 101
12345XXX1238M1ZE5E                                                         2 201
12345XXX1238M1ZE5E                                                         29401
12345XYZ1235L1FK1EJ2A9175944TRE111111ZZZ2010007 0109323       M  AZK47     2 101
12345XYZ1235L1FK1E                                                         2 201
12345XYZ1235L1FK1E                                                         29401


Expected Output:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
12345XXX1238M1ZE5E76AF178398TRE111111ZZZ2010-01-06 0109323    M  AZK56     2 101
12345XXX1238M1ZE5E                                                         2 201
12345XXX1238M1ZE5E                                                         29401
12345XYZ1235L1FK1EJ2A9175944TRE111111ZZZ2010-01-07 0109323    M  AZK47     2 101
12345XYZ1235L1FK1E                                                         2 201
12345XYZ1235L1FK1E                                                         29401


Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Tue Jan 12, 2010 5:19 am    Post subject: this is for DFSORT v1.5 Reply with quote

Hi, Frank.

Sorry. I forgot to mention the characteristics of input and output files.

Input File: LRECL: 80 AND RECFM: FB
Output File: LRECL: 80 AND RECFM: FB

We are using DFSORT v1.5. No upgrades to be done till 2011.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Tue Jan 12, 2010 11:50 am    Post subject: Reply with quote

Quote:
We are using DFSORT v1.5. No upgrades to be done till 2011.


As I said, it's not that you're using DFSORT V1R5 - it's that you don't have the functional PTFs applied. In order to see if/how you can do what you want with your level of DFSORT, I need to know what that level is. So please run this DFSORT job and post the //SYSOUT messages you receive.

Code:

//S1    EXEC  PGM=SORT       
//SYSOUT    DD  SYSOUT=*     
//SORTIN DD *               
RECORD                       
//SORTOUT DD DUMMY           
//SYSIN    DD    *           
  OPTION COPY               
/*                           

_________________
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
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Jan 14, 2010 2:47 am    Post subject: here are the details. Reply with quote

Hi, Frank.

Here are the details you have asked for :-

Code:

ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 02:00 ON WED JAN 13, 2010 -
            OPTION COPY                                                         
ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE751I 0 C5-BASE   C6-BASE   C7-BASE   C8-Q83041 E9-BASE   C9-BASE   E5-Q90312 E7-Q91626
ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED   
ICE088I 0 MFUSERS .S1      .        , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6278238)                                 
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6200798,6200798)                           
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,RESET=Y,VSAMEMT=Y,DYNSPC=256
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERET=RC16 ,MSGDDN=SYSOUT
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO   ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=N,DYNALOC=N             ,ABCODE=MSG
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=N,STIMER=Y,COBEXIT=COB2
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=Y,DSA=0
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE    ,EXITCK=S,PARMDDN=DFSPARM ,FSZEST=N
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMIO=N,MOSIZE=MAX
ICE235I 0 OPTIONS: NULLOUT=RC0                     
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT       
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN       
ICE751I 1 EF-Q91626 F0-Q84357 E8-Q91626             
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE055I 0 INSERT 0, DELETE 0                       
ICE054I 0 RECORDS - IN: 1, OUT: 1                   
ICE052I 0 END OF DFSORT                             


Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Thu Jan 14, 2010 1:26 pm    Post subject: Reply with quote

If I understand it correctly, you want to change the year and also convert a julian date (ccyyddd) to a gregorian date (ccyy-mm-dd).

You can certainly do that with the latest level of DFSORT (Nov, 2009), but your site is very behind in installing DFSORT functional PTFs, so I don't see a way to do it at your level.
_________________
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
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Jan 14, 2010 11:48 pm    Post subject: thx Reply with quote

Frank, thanks.

Can you let me know the solution with DFSORT v1.8 or 1.9 so that I at least get the solution to see.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Fri Jan 15, 2010 11:44 am    Post subject: Reply with quote

z/OS DFSORT V1R5 is used for z/OS 1.8 and 1.9. z/OS DFSORT V1R10 is used for z/OS 1.10 and 1.11. You don't need a new version of DFSORT for the new functions - you just need to install the appropriate Nov, 2009 DFSORT PTF on your current version of DFSORT.

At this point, I'm not sure exactly which requirement we're talking about. Is it the one where you have 0, 1, 2 in 41 and you want to insert the first 3 digits of the current year, and/or is it the one where you want to change the julian date to a gregorian date, or what? For the situation you want the job for, please show an example of the records in the input file and what you expect for output, and explain the "rules" for getting from input to output. Once I know what you want, I can show you the job.
_________________
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
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Sun Jan 17, 2010 9:28 am    Post subject: your guess is correct. Reply with quote

Hi, Frank.

Quote:

the one where you have 0, 1, 2 in 41 and you want to insert the first 3 digits of the current year, and/or is it the one where you want to change the julian date to a gregorian date, or what?


Yes. Your guess is correct. I want to achieve the both. For requirement one, you have provided the solution. Would you please provide it for requirement two?

Input:
Code:
 
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
12345XXX1238M1ZE5E76AF178398TRE111111ZZZ2010006 0109323       M  AZK56     2 101
12345XXX1238M1ZE5E                                                         2 201
12345XXX1238M1ZE5E                                                         29401
12345XYZ1235L1FK1EJ2A9175944TRE111111ZZZ2010007 0109323       M  AZK47     2 101
12345XYZ1235L1FK1E                                                         2 201
12345XYZ1235L1FK1E                                                         29401


Output:
Code:
 
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
12345XXX1238M1ZE5E76AF178398TRE111111ZZZ2010-01-06 0109323    M  AZK56     2 101
12345XXX1238M1ZE5E                                                         2 201
12345XXX1238M1ZE5E                                                         29401
12345XYZ1235L1FK1EJ2A9175944TRE111111ZZZ2010-01-07 0109323    M  AZK47     2 101
12345XYZ1235L1FK1E                                                         2 201
12345XYZ1235L1FK1E                                                         29401


Thank you.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Mon Jan 18, 2010 1:34 pm    Post subject: Reply with quote

With the Nov, 2009 DFSORT PTF installed, you can use these control statements:

Code:

  OPTION COPY                                 
  INREC BUILD=(1,40,41,7,Y4T,TOGREG=Y4T(-),   
    51:48,8,63:63,18)                         

_________________
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
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