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
 

 

DFSORT : using OUTREC functions

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

New User


Joined: 12 May 2008
Posts: 13
Location: Hartford

PostPosted: Mon May 12, 2008 7:32 pm    Post subject: DFSORT : using OUTREC functions
Reply with quote

Hi, I have a file with records having Date as 03/24/08.

Code:

XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|12/24/08| ~


Is there some way using OUTREC functions to Make the Record in the below format. For this the Key is XLTAGS.

Code:

XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|DECEMBER 2008| ~.


In the input file there are different combinations of Date like

Code:

XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|03/19/09| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|04/30/07| ~


Thanks,
Vikas
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon May 12, 2008 8:01 pm    Post subject:
Reply with quote

I think you will need to use 12 IFTHENs to translate the numeric month to the character month name.
Back to top
View user's profile Send private message
Vsonawane

New User


Joined: 12 May 2008
Posts: 13
Location: Hartford

PostPosted: Mon May 12, 2008 8:11 pm    Post subject:
Reply with quote

Thanks CICS Guy! you are right i will need 12 IFTHEN.

But i am not able to find any example for using IFTHEN in Outrec fields.After checking for the Month i should be able to pick the year, add leading 20, trailing `. this should affect only XLTAGS Records. Can you please provide any sample code? if any?

Thanks
Vikas
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon May 12, 2008 8:28 pm    Post subject:
Reply with quote

Have you looked at the manual?
Examples are always handy:
Code:

 |     OPTION COPY
 |     OUTREC IFTHEN=(WHEN=(3,2,SS,EQ,C'FR,MX,GR'),
 |                     OVERLAY=(11:DATE=(DM4.),TIME1(.))),
 |            IFTHEN=(WHEN=(3,2,SS,EQ,C'CN,US,EN'),
 |                     OVERLAY=(11:DATE=(4MD/),TIME1(:)))
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 182
Location: hyderabad

PostPosted: Mon May 12, 2008 8:34 pm    Post subject:
Reply with quote

Vsonawane,
Please check the below code.

Code:

//S1    EXEC  PGM=ICETOOL                                   
//TOOLMSG DD SYSOUT=*                                       
//DFSMSG  DD SYSOUT=*                                       
//IN0 DD *                                                   
XLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|12/24/08|~       
RLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|12/24/08|~       
RLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|12/24/08|~       
XLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|12/24/08|~       
//IN1 DD DSN=XXXX.T3,UNIT=SCRPK,SPACE=(CYL,(6,6)),       
//       DISP=(NEW,CATLG,DELETE),DCB=(RECFM=FBA,LRECL=80)   
//OUT DD DSN=XXXX.T4,UNIT=SCRPK,SPACE=(CYL,(6,6)),       
//       DISP=(NEW,CATLG,DELETE),DCB=(RECFM=FB,LRECL=80)     
//TOOLIN DD *                                               
SORT FROM(IN0) TO(IN1) USING(CTL0)                           
SORT FROM(IN1) TO(OUT) USING(CTL1)                           
/*                                                           
//CTL0CNTL DD *                                             
  SORT FIELDS=COPY                                           
  OUTREC FIELDS=(1,50,51,2,Y2C,53,2)                         
//CTL1CNTL DD *                                             
SORT FIELDS=COPY                                   
OUTREC IFTHEN=(WHEN=(45,2,CH,EQ,C'01'),           
               BUILD=(1,44,C'JANUARY',51,6)),     
       IFTHEN=(WHEN=(45,2,CH,EQ,C'02'),           
               BUILD=(1,44,C'FEBRUARY',51,6)),     
       IFTHEN=(WHEN=(45,2,CH,EQ,C'03'),           
               BUILD=(1,44,C'MARCH',51,6)),       
       IFTHEN=(WHEN=(45,2,CH,EQ,C'04'),           
               BUILD=(1,44,C'APRIL',51,6)),       
       IFTHEN=(WHEN=(45,2,CH,EQ,C'05'),           
               BUILD=(1,44,C'MAY  ',51,6)),       
       IFTHEN=(WHEN=(45,2,CH,EQ,C'06'),           
               BUILD=(1,44,C'JUNE ',51,6)),       
       IFTHEN=(WHEN=(45,2,CH,EQ,C'07'),           
               BUILD=(1,44,C'JULY ',51,6)),       
       IFTHEN=(WHEN=(45,2,CH,EQ,C'08'),           
               BUILD=(1,44,C'AUGUST',51,6)),       
       IFTHEN=(WHEN=(45,2,CH,EQ,C'09'),           
               BUILD=(1,44,C'SEPTEMBER',51,6)),   
       IFTHEN=(WHEN=(45,2,CH,EQ,C'10'),           
               BUILD=(1,44,C'OCTOBER',51,6)),     
       IFTHEN=(WHEN=(45,2,CH,EQ,C'11'),           
               BUILD=(1,44,C'NOVEMBER',51,6)),     
       IFTHEN=(WHEN=(45,2,CH,EQ,C'12'),           
               BUILD=(1,44,C'DECEMBER',51,6))     


The output in the file OUT will look like,

Code:


XLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|DECEMBER2008|~
RLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|DECEMBER2008|~
RLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|DECEMBER2008|~
XLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|DECEMBER2008|~


Thanks
Krishy
Back to top
View user's profile Send private message
Vsonawane

New User


Joined: 12 May 2008
Posts: 13
Location: Hartford

PostPosted: Mon May 12, 2008 8:59 pm    Post subject:
Reply with quote

Thanks CICS GUY and Sril!

I was looking for a clue and have achieved 80% of my results. Now one more question..is it possible to suppress some data from the Input file using some parameters along with OUTREC IFTHEN=WHEN? say i wont require data from column 35 - 40 in output file. Whatever may be the data?

Appreciate your response. I am happy to see such quick response, because i used this forum for the first time.

Thanks,
Vikas
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon May 12, 2008 9:11 pm    Post subject: Re: DFSORT : OUTREC
Reply with quote

Code:
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|12/24/08| ~
                                  CV23|0
0000000001111111111222222222233333333334
1234567890123456789012345678901234567890
You want to drop the "CV23|0"?
Change the BUILD to skip the field you don't want.....
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: Mon May 12, 2008 10:02 pm    Post subject:
Reply with quote

Vikas,

You don't need two passes to do this - a single pass will do. (Krishy seems to have a preference for inefficient code.) Here's a one pass solution for what you asked for. I had to guess at what your input records look like and what you wanted the output records to looke like since it wasn't clear. If you want the output records to look some other way, please show a better example of how you want them to look. If you want to remove some bytes, show an example of the output records for that.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|01/19/09| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|02/19/09| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|03/19/09| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|04/30/07| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|05/30/07| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|06/30/07| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|07/30/07| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|08/30/07| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|09/30/07| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|10/30/07| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|11/30/07| ~
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|12/24/08| ~
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,48,57:C'20',53,5)),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'01'),OVERLAY=(47:C'JANUARY')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'02'),OVERLAY=(47:C'FEBRUARY')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'03'),OVERLAY=(47:C'MARCH')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'04'),OVERLAY=(47:C'APRIL')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'05'),OVERLAY=(47:C'MAY')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'06'),OVERLAY=(47:C'JUNE')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'07'),OVERLAY=(47:C'JULY')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'08'),OVERLAY=(47:C'AUGUST')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'09'),OVERLAY=(47:C'SEPTEMBER')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'10'),OVERLAY=(47:C'OCTOBER')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'11'),OVERLAY=(47:C'NOVEMBER')),
       IFTHEN=(WHEN=(47,2,CH,EQ,C'12'),OVERLAY=(47:C'DECEMBER'))
/*


SORTOUT would have:

Code:

XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|JANUARY   2009| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|FEBRUARY  2009| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|MARCH     2009| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|APRIL     2007| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|MAY       2007| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|JUNE      2007| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|JULY      2007| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|AUGUST    2007| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|SEPTEMBER 2007| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|OCTOBER   2007| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|NOVEMBER  2007| ~   
XLTAGS|MENDENHALL CONSULTING   |0CCV23|0CCV23|DECEMBER  2008| ~   
Back to top
View user's profile Send private message
Vsonawane

New User


Joined: 12 May 2008
Posts: 13
Location: Hartford

PostPosted: Tue May 13, 2008 9:20 am    Post subject: Reply to: DFSORT : OUTREC
Reply with quote

Hi Frank,

The input record which you guessed in perfect.
XLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|05/19/09| ~
XLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|03/19/07| ~

Along with this records there are some other detail records like
03/19/07|MENDENHALL CONSULTING |0CCV23|0CCV23|01/19/09|COMMENTS|-123.00| ~.

So my requirment is to remove the Commison Paid column(-123.00) from the Detail records, change the first colomn numeric date to word format(January 07). And change the XLTAGS records only for dates.

so the o/p detail record should look
March 07|MENDENHALL CONSULTING |0CCV23|0CCV23|01/19/09|COMMENTS| ~.

And XLTAGS should look like
XLTAGS|MENDENHALL CONSULTING |0CCV23|0CCV23|May 09| ~

Thanks Frank, Hope above clarifies my requirement.

Thanks,
Vikas
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: Tue May 13, 2008 8:53 pm    Post subject:
Reply with quote

What is the RECFM and LRECL of the input file?

Do you only have XLTAGS records and "detail" records, or are there also other types of records in the file?

Can we identify the "detail" records as those records which do NOT start with 'XLTAGS' or is there some other way to identify them?

Are the fields in your records in fixed positions? If so, please give the layout of the fields in each type of record (starting position, length and format of each field).

Or are we talking about delimited fields here?

It would help if you'd give a better example of your input records and expected output records with more variations. And please use code tags for the data.
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 How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts SORT- outrec ram_vizag DFSORT/ICETOOL 10 Tue Sep 27, 2016 12:50 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts OUTREC FILELDS FAILS WITH ICE126A 2 ... balaji81_k DFSORT/ICETOOL 8 Sat Jul 02, 2016 1:22 am


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