Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort into 2 files - but "date constant" changes ev

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 49
Location: USA

PostPosted: Wed Apr 04, 2012 10:59 pm    Post subject: Sort into 2 files - but "date constant" changes ev
Reply with quote

Hello All,

I was wondering if you could help me set up a sort step where I would not have to reset the condition every year.

Right now I have a file with records with both years 2011 and 2012 (these values are in the data). I can easily separate those into two files right now.

But, next year I will have records with data of 2012 and 2013, and the following year 2013 and 2014.

Is there a way to create a sort that will write two separate files based on the year (data) and I won't have to revise the sysin every year with the specific years that need to be sorted out?

Thank you very much for all your advice!!
Sharon
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Wed Apr 04, 2012 11:22 pm    Post subject:
Reply with quote

Ummmm - as usual - show us some sample data including the positions, formats and lengths of the two fields, tell us the lrecl and recfm, and show us the expected output. Yes, I know that the output is going to be the same as the input but with both years incremented by one.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 05, 2012 1:48 am    Post subject: Reply to: Sort into 2 files - but "date constant"
Reply with quote

Sysaron,

Use the following DFSORT Which will give you the desired results
Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
2012     FILE-1                                               
2012     FILE-1                                               
2012     FILE-1                                               
2013     FILE-2                                               
2013     FILE-2                                               
2014     DROP                                                 
//OUT1     DD SYSOUT=*                                         
//OUT2     DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC OVERLAY=(81:DATE1,81,8,Y4T,ADDYEARS,+1,TOGREG=Y4T)     
  OUTFIL FNAMES=OUT1,BUILD=(1,80),INCLUDE=(1,4,CH,EQ,81,4,CH) 
  OUTFIL FNAMES=OUT2,BUILD=(1,80),INCLUDE=(1,4,CH,EQ,89,4,CH) 
//*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Apr 05, 2012 2:04 am    Post subject:
Reply with quote

Here's another way to do this with DFSORT using the system symbol for the current year:

Code:

//STEP0100 EXEC PGM=SORT                                             
//SYMNAMES DD *                                                       
CURYR,S'&LYR4'                                                       
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                       
2012     FILE-1                                                       
2012     FILE-1                                                       
2012     FILE-1                                                       
2013     FILE-2                                                       
2013     FILE-2                                                       
2014     DROP                                                         
//OUT1     DD SYSOUT=*                                               
//OUT2     DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  SORT FIELDS=COPY                                                   
  INREC OVERLAY=(81:CURYR,81:81,4,ZD,ADD,+1,EDIT=(TTTT))             
  OUTFIL FNAMES=OUT1,BUILD=(1,80),INCLUDE=(1,4,CH,EQ,CURYR)           
  OUTFIL FNAMES=OUT2,BUILD=(1,80),INCLUDE=(1,4,CH,EQ,81,4,CH)         
//*                                                                   
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 49
Location: USA

PostPosted: Thu Apr 05, 2012 2:43 am    Post subject: Sort into 2 files - but "date constant" changes ev
Reply with quote

Hello again everyone!
Thank you so much for all your advice. It is obvious to me though, that I should have been more precise about my situation.

Here is the file layout of my 57 character length file. The first 2 bytes are the year shown as 11 or 12. I have to put the 11's in one file and the 12's in another. Next year the 12's in one file and 13's in another.

EDIT SYSTC.ADD.EXTRACT.TEST Columns 00001 00057
Command ===> Scroll ===> CSR
****** ***************************** Top of Data 110103054000000303520111105000000045000000000000020120330
110150003000011358720110806000006815000000000000020120330
110150005000000000020110806000000000000000000000020120330
120150006000010974920110806000006584000000000000020120330
120150012000022387920120121000013432000000000000020120330
120150013000004085020120121000002451000000000000020120330

Based on the info I received, I tried this SYSIN without good results.

//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(58:DATE1,58,8,Y4T,ADDYEARS,+1,TOGREG=Y4T)
OUTFIL FNAMES=OUT1,BUILD=(1,57),INCLUDE=(1,2,CH,EQ,58,2,CH)
OUTFIL FNAMES=OUT2,BUILD=(1,57),INCLUDE=(1,2,CH,EQ,60,2,CH)
/*
Thanks again for your patience and understanding
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Thu Apr 05, 2012 3:25 am    Post subject: Reply to: Sort into 2 files - but "date constant"
Reply with quote

If you need year minus one and current year, does subtracting instead of adding help you for this year?

What you haven't told is is the year with which you want to run the data. If you have 11 and 12 in the data, do you always run with 12? Same situation in future years? I think the subtract should work.

If not, what are the rules for the "current year" when you run?
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 49
Location: USA

PostPosted: Thu Apr 05, 2012 3:47 am    Post subject:
Reply with quote

Hi Bill,

You are right. This year I run with 12's and the old year 11's.
Next Year with 13's and the old year 12's.

I tried using subtraction, but my problem is that I'm not familiar with the overlay reserved words. Could you please help me with the overlay? I have this now.

SORT FIELDS=COPY
INREC OVERLAY=(58:DATE1,58,8,Y4T,ADDYEARS,-1,TOGREG=Y4T)
OUTFIL FNAMES=OUT1,BUILD=(1,57),INCLUDE=(1,2,CH,EQ,58,2,CH)
OUTFIL FNAMES=OUT2,BUILD=(1,57),INCLUDE=(1,2,CH,EQ,60,2,CH)
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 05, 2012 3:54 am    Post subject: Reply to: Sort into 2 files - but "date constant"
Reply with quote

sysaron,

You got the include condition wrong. Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYMNAMES DD *                                             
CURYR,S'&LYR4'                                               
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
----+----1----+----2----+----3----+----4----+----5----+----6-
110150003000011358720110806000006815000000000000020120330   
110150005000000000020110806000000000000000000000020120330   
120150006000010974920110806000006584000000000000020120330   
120150012000022387920120121000013432000000000000020120330   
120150013000004085020120121000002451000000000000020120330   
//OUT1     DD SYSOUT=*                                       
//OUT2     DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC OVERLAY=(58:CURYR,58,4,ZD,SUB,+1,EDIT=(TTTT))       
  OUTFIL FNAMES=OUT1,BUILD=(1,57),INCLUDE=(1,2,CH,EQ,60,2,CH)
  OUTFIL FNAMES=OUT2,BUILD=(1,57),INCLUDE=(1,2,CH,EQ,64,2,CH)
//*
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 49
Location: USA

PostPosted: Thu Apr 05, 2012 4:04 am    Post subject: Reply to: Sort into 2 files - but "date constant"
Reply with quote

icon_biggrin.gif It worked Perfectly Skolusu !!!!

Thank you Thank you Thank you Sooooooo Much !!!!!!!!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Apr 05, 2012 10:41 pm    Post subject:
Reply with quote

For the record, you can also do this with the symbols method like this:

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYMNAMES DD *                                                       
CURYR2,S'&LYR2'                                                       
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
110150003000011358720110806000006815000000000000020120330
110150005000000000020110806000000000000000000000020120330
120150006000010974920110806000006584000000000000020120330
120150012000022387920120121000013432000000000000020120330
120150013000004085020120121000002451000000000000020120330
//OUT1     DD SYSOUT=*                                                 
//OUT2     DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  SORT FIELDS=COPY                                                     
  INREC OVERLAY=(81:CURYR2,81:81,2,ZD,SUB,+1,EDIT=(TT))               
  OUTFIL FNAMES=OUT1,BUILD=(1,80),INCLUDE=(1,2,CH,EQ,CURYR2)           
  OUTFIL FNAMES=OUT2,BUILD=(1,80),INCLUDE=(1,2,CH,EQ,81,2,CH)         
//*                                                                   


Of course, this will only work correctly until 2099. icon_wink.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us