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 - formatting and reporting the formatted records

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

New User


Joined: 10 Jun 2005
Posts: 13
Location: London, UK

PostPosted: Thu Mar 09, 2006 8:50 pm    Post subject: DFSORT - formatting and reporting the formatted records
Reply with quote

Hello,

I have a requirement to reformat records in a file based on a criteria and also will need to list all the formatted records in a report for audit purposes. How to write a record to a report file alongwith reformatting it to the output file?

e.g Requirement is in the given input VSAM file
Change position 10-11 to value '24' if position 5 is 'o'.
This can be achieved using IFTHEN Overlay or with CHANGE option of OUTREC. But all the records being changed this way have to be sent to a report file which would list the records changed and trailer with the count of records modified. Can it be achieved using OUTFIL or do i have to create a report first using a separate step identifying records satisfying the criteria and then perform the update in another step? .
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 Mar 09, 2006 10:00 pm    Post subject:
Reply with quote

With DFSORT, you can set an indicator after the end of the record that will allow you to do what you want. Use IFTHEN WHEN=INIT to initialize the indicator to '0' in all of the records. In your IFTHEN WHEN=cond clause, set the indicator to '1' to indicate the record was changed. Then you can use the indicator to include only the records with '1' using OUTFIL INCLUDE. You can remove the indicator with OUTFIL as well.
Back to top
View user's profile Send private message
marpana

New User


Joined: 10 Jun 2005
Posts: 13
Location: London, UK

PostPosted: Fri Mar 10, 2006 5:39 pm    Post subject: Re: DFSORT - formatting and reporting the formatted records
Reply with quote

Thank you very much for your help Frank. I tried to implement your suggestion as below. It works with one problem. The input file is KSDS VSAM and is variable length( average record size 62, max recsz=1220).
The end result expected is to update this file to change certain fields for recrods satisfying the criteria.
Code:

//sort        EXEC PGM=ICETOOL
//REPORTF  DD SYSOUT=*                                     
//INVSAM   DD DSN=TTFB.MARALA.LCOLOC30,DISP=SHR             
//TEMPFILE DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(50,50))     
//OUTVSAM  DD DSN=TTFB.MARALA.LCOLOC30,DISP=OLD             
//TOOLIN   DD *                                             
  COPY FROM(INVSAM) TO(TEMPFILE) USING(CNT1)               
  COPY FROM(TEMPFILE) USING(CNT2)                           
/*                                                         
//CNT1CNTL DD *                                             
  OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'D',AND,19,2,CH,EQ,C'22'),
         OVERLAY=(19:C'24',1221:C'1',1222:1,18,1240:19,2)),
        IFTHEN=(WHEN=NONE,OVERLAY=(1221:C'0',20X))         
/*                                                         
//CNT2CNTL DD *                                             
  OUTFIL FNAMES=OUTVSAM,OUTREC=(1,1220)                     
  OUTFIL FNAMES=REPORTF,                                   
         INCLUDE=(1221,1,CH,EQ,C'1'),OUTREC=(1221,21)     
 *further report details such as header and trailer etc. to be coded.
 /*                                     

I am trying to add the indicator byte at postion 1221( after the max recsz length) and some data which will help display old and new values for the changed fields in report file.
The problem is, sort treats the input VSAM file as record type F and after execution of above step I see the records are being padded with x'00' to make all equal to length 1220.

my question is how do I add the indicator flag to variable length VSAM file and get an updated VSAM file without affecting the length of records?

Your help is very much appreciated.
Back to top
View user's profile Send private message
marpana

New User


Joined: 10 Jun 2005
Posts: 13
Location: London, UK

PostPosted: Fri Mar 10, 2006 10:20 pm    Post subject: Re: DFSORT - formatting and reporting the formatted records
Reply with quote

Here is another way I could get the expected result but with one drawback.I need to repeat the conditions in two places.
( Would be adding 64 more conditions and overlays)


//STEP020 EXEC PGM=SORT
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//REPORTF DD SYSOUT=*
//SORTIN DD DSN=TTFB.MARALA.LCOLOC30,DISP=SHR
//*EMPFILE DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(50,50))
//OUTVSAM DD DSN=TTFB.MARALA.LCOLOC30.TRFM,DISP=OLD
//SYSIN DD *
RECORD TYPE=V
OPTION COPY,VLSHRT,VSAMIO,RESET
OUTFIL FNAMES=REPORTF,CONVERT,
INCLUDE=(5,1,CH,EQ,C'D',AND,23,2,CH,EQ,C'22'),
OUTREC=(5,20)
OUTFIL FNAMES=OUTVSAM,
IFTHEN=(WHEN=(5,1,CH,EQ,C'D',AND,23,2,CH,EQ,C'22'),
OVERLAY=(23:C'24'))
/*

is there a way to do this without repeating the same condition in two places? .

( I realized I could not make use of VSAMIO and RESET options to do in-place because I am performing a copy option. Hence needed to use a different o/p dataset than sortin. adds another step to load it back.)
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: Fri Mar 10, 2006 10:21 pm    Post subject:
Reply with quote

Specify:

Code:

    RECORD TYPE=V


That tells DFSORT to treat the VSAM records as variable so it will append an RDW in positions 1-4. Put your indicator in position 5 and shift the rest of your records over 1 position to the right, e.g.

Code:

   IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'0',6:5)),
     ...


Now you can use position 5 for the indicator, but remember to use p+1 instead of p for the other fields.

To remove the indicator, use: (1,4,5:6)
Back to top
View user's profile Send private message
marpana

New User


Joined: 10 Jun 2005
Posts: 13
Location: London, UK

PostPosted: Fri Mar 10, 2006 11:33 pm    Post subject: Re: DFSORT - formatting and reporting the formatted records
Reply with quote

That works perfect. Thank you Frank. Also i think if i insert the 'modify tag' in 'When=NONE' then I can use original positions P instead of P+1 when checking for the conditions.

for reference tried as below
9 //STEP020 EXEC PGM=SORT
0 //SYSUDUMP DD SYSOUT=*
1 //SYSOUT DD SYSOUT=*
2 //SYSPRINT DD SYSOUT=*
3 //REPORTF DD SYSOUT=*
4 //SORTIN DD DSN=TTFB.MARALA.LCOLOC30,DISP=SHR
5 //OUTVSAM DD DSN=TTFB.MARALA.LCOLOC30.TRFM,DISP=OLD
6 //SYSIN DD *
7 RECORD TYPE=V
8 OPTION COPY,VLSHRT
9 INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'0',6:5)),
0 IFTHEN=(WHEN=(6,1,CH,EQ,C'D',AND,24,2,CH,EQ,C'22'),
1 BUILD=(1,4,5:C'1',6:6,18,24:C'24',26:26))
2 OUTFIL FNAMES=REPORTF,CONVERT,
3 INCLUDE=(5,1,CH,EQ,C'1'),
4 OUTREC=(6,20)
5 OUTFIL FNAMES=OUTVSAM,OUTREC=(1,4,5:6)
6 /*
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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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