IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Is it possible to extract data this way in SORT.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rmd3003

New User


Joined: 03 Jul 2006
Posts: 55

PostPosted: Sat Oct 27, 2012 1:53 am
Reply with quote

Let's say I'm already given old backups of reports and need to split them based on specific condition. Below is how data looks on dataset.
Can I extract specific "WAREHOUSE ID" to separate file (let's say "BBB")?
Thank you in advance......

INPUT FILE:
Code:
                                  MY COMPANY NAME                       
PROGRAM: PGM001A                  REPORT NAME HERE          PAGE: XXXX 
REPORT:  P001RPT                  SOME OTHER HEADER         DATE: XX/XX
                                                                       
DATE: 10/26/2012                                                       
WAREHOUSE ID: AAA                                                       
WAREHOUSE ADDRESS:  SOMEWHERE 11111                                     
                                                                       
 PART           PART         PART                 PART                 
 NUMBER         PRICE        SERIAL               DESCRIPTION           
                                                                       
 100009821     $100.00       081234325234         SOMETHING HERE01     
 100009726     $200.00       018667462345         SOMETHING HERE02     
 100009825     $300.00       981234321248         SOMETHING HERE03     
 100009342     $400.00       018123442309         SOMETHING HERE04     
                                                                       
TOTAL:        $1000.00                                                 


                                                                       
PROGRAM: PGM001A                  REPORT NAME HERE          PAGE: XXXX 
REPORT:  P001RPT                  SOME OTHER HEADER         DATE: XX/XX
                                                                       
DATE: 10/26/2012                                                       
WAREHOUSE ID: BBB                                                     
WAREHOUSE ADDRESS:  SOMEWHERE 22222                                   
                                                                       
 PART           PART         PART                 PART                 
 NUMBER         PRICE        SERIAL               DESCRIPTION         
                                                                       
 340009821     $600.00       777777777234         SOMETHING HERE01     
 350009726     $500.00       744444444345         SOMETHING HERE02     
 350009825     $400.00       987777721248         SOMETHING HERE03     
                                                                       
 TOTAL:       $1500.00                                                 



PROGRAM: PGM001A                  REPORT NAME HERE          PAGE: XXXX 
REPORT:  P001RPT                  SOME OTHER HEADER         DATE: XX/XX
                                                                       
DATE: 10/26/2012                                                       
WAREHOUSE ID: CCC                                                     
WAREHOUSE ADDRESS:  SOMEWHERE 33333                                   
                                                                       
 PART           PART         PART                 PART                 
 NUMBER         PRICE        SERIAL               DESCRIPTION         
                                                                       
 440009824     $300.00       444777777234         SOMETHING HERE01     
 450009824     $400.00       987777721248         SOMETHING HERE03     
                                                                       
 TOTAL:        $700.00                                                 


So my output file looks like this:

Code:
PROGRAM: PGM001A                  REPORT NAME HERE          PAGE: XXXX 
REPORT:  P001RPT                  SOME OTHER HEADER         DATE: XX/XX
                                                                       
DATE: 10/26/2012                                                       
WAREHOUSE ID: BBB                                                     
WAREHOUSE ADDRESS:  SOMEWHERE 22222                                   
                                                                       
 PART           PART         PART                 PART                 
 NUMBER         PRICE        SERIAL               DESCRIPTION         
                                                                       
 340009821     $600.00       777777777234         SOMETHING HERE01     
 350009726     $500.00       744444444345         SOMETHING HERE02     
 350009825     $400.00       987777721248         SOMETHING HERE03     
                                                                       
 TOTAL:       $1500.00                                                 
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Oct 27, 2012 3:13 am
Reply with quote

Yes.

You can look at this topic. The same technique can be applied to your report.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Sat Oct 27, 2012 4:01 am
Reply with quote

I used below sort card to generate the output.

Code:
//STEP01  EXEC PGM=SORT       
//SYSPRINT  DD SYSOUT=*       
//SYSOUT    DD SYSOUT=*       
//INA       DD DSN=<Your Input file>,DISP=SHR
//INB       DD DSN=<Your Input file>,DISP=SHR
//SORTOUT   DD SYSOUT=*                                                 
//SYSIN  DD  *                                                         
 SORT FIELDS=COPY                                                       
 JOINKEYS F1=INA,FIELDS=(81,10,A)                                       
 JOINKEYS F2=INB,FIELDS=(81,10,A)                                                                                         
 REFORMAT FIELDS=(F1:1,90,?,F2:1,91)                                   
 INCLUDE COND=(182,1,CH,EQ,C'1')                                       
 OUTREC FIELDS=(1:1,80)                                                 
/*                                                                     
//JNF1CNTL DD *                                                         
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,7,CH,EQ,C'PROGRAM'),                 
               END=(1,6,CH,EQ,C' TOTAL'),                               
               PUSH=(81:ID=10))                                         
/*                                                                     
//JNF2CNTL DD *                                                         
 INCLUDE COND(1,12,CH,EQ,C'WAREHOUSE ID')                               
 INREC IFTHEN=(WHEN=INIT,                                               
               BUILD=(1:1,80,81:SEQNUM,10,ZD,START=1,INCR=1,91:C'1')), 
       IFTHEN=(WHEN=(1,17,CH,NE,C'WAREHOUSE ID: BBB'),                 
               OVERLAY=(91:C'0')) 
/*                                 
Back to top
View user's profile Send private message
rmd3003

New User


Joined: 03 Jul 2006
Posts: 55

PostPosted: Mon Oct 29, 2012 5:55 pm
Reply with quote

saiprasadh, thank you very much.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Oct 29, 2012 5:59 pm
Reply with quote

Is it possible for you to have more than one page of report for the warehouse in question? If so, test it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top