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 

DFSORT Report

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
menon
Beginner


Joined: 06 Jun 2003
Posts: 2
Topics: 1

PostPosted: Fri Jun 06, 2003 3:43 am    Post subject: DFSORT Report Reply with quote

I am just wondering if I could create the following report using one sort statement.
My requirement follows.
I have 2 Input Files , File A and File B
Code:
FILE A
1 Header Record 050603
2 Detail - 1
2 Detail - 2
2 Detail - 3
9 Trailer record 3




Code:
FILE B
1 Header Record 050603
2 Detail - 1
2 Detail - 2
2 Detail - 3
2 Detail - 4
2 Detail - 5
9 Trailer record 5



My requirement follows.
1) If the header date in both file does not match then return code should be greater 0
2) I have to format the Header date as 'June 05,2003' if the date is 050603.
3) I have to add the trailer count in both files and print it on the report
4) Also I need to print the record count on each trailer record individually.


Code:
Report Format
' 30 byte Hard coded text ' June 05,2003 '20 byte hardcoded text'
Total record count is 8
blank line
Record count on File A is 3
blank line
Record count on File B is 5
blank line
' 65 byte hardcoded text'


I appreciate all your help.
Thanks,
Menon.
Back to top
View user's profile Send private message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Fri Jun 06, 2003 8:09 am    Post subject: Reply with quote

Try EZtreive

Code:

*******
//STEP01   EXEC PGM=EZTPA00,REGION=2500K         
//EZTVFM   DD  UNIT=WORK,SPACE=(4096,(100,100))   
//FILEA    DD  DSN=INPUT1   ,DISP=SHR             
//FILEB    DD  DSN=INPUT2,DISP=SHR               
//REPORT1  DD  SYSOUT=*                           
//SYSPRINT DD SYSOUT=*                           
//SYSOUT   DD SYSOUT=*                           
//SYSIN    DD *                                   
FILE FILEA                                       
KEY-A            11    7    A                     
DATE-A           21   08    A                     
*                                                 
FILE FILEB                                       
KEY-B            11    7    A                     
DATE-B           21   08    A                     
*                                                 
FILE REPORT1 PRINTER                             
*                                                 
FILE MNTHTAB TABLE INSTREAM                       
ARG  1 2 A                                       
DESC 4 3 A                                       
01 JAN                                           
02 FEB                                           
03 MAR                                           
04 APR                                           
05 MAY                                           
06 JUN                                           
07 JUL                                           
08 AUG                                           
09 SEP                                           
10 OCT                                           
11 NOV                                           
12 DEC                                           
ENDTABLE                                         
*                                                 
FILE SORTCURR     F    80   VIRTUAL               
KEY-CURR         11    7    A                     
DATE-CURR        21   08    A                                   
DATE-CURR-DD     21   02    A                                   
DATE-CURR-MM     23   02    A                                   
DATE-CURR-YY     25   04    A                                   
*                                                               
FILE SORTPREV     F    80   VIRTUAL                             
KEY-PREV         11    7    A                                   
DATE-PREV        21   08    A                                   
DATE-PREV-DD     21   02    A                                   
DATE-PREV-MM     23   02    A                                   
DATE-PREV-YY     25   04    A                                   
**                                                               
COUNT-CURR   W   6  N  VALUE 1                                   
COUNT-PREV   W   6  N  VALUE 1                                   
COUNT-TOT    W   6  N  MASK ('ZZZZ99')                           
REP-DATE     W   13   A                                         
REP-DATE-DD  REP-DATE         3 A                               
FILLER-1     REP-DATE +3      2 A                               
REP-DATE-MM  REP-DATE +5      3 A                               
FILLER-2     REP-DATE +8      2 A VALUE ' ,'                     
REP-DATE-YY  REP-DATE +10     3 A                               
*                                                               
SORT  FILEA TO  SORTCURR  USING (KEY-A)                         
SORT  FILEB TO  SORTPREV  USING (KEY-B)                         
*                                                               
JOB INPUT (SORTCURR KEY (KEY-CURR) +                             
           SORTPREV KEY (KEY-PREV)) FINISH END-PARA             
IF COUNT-CURR = 1 AND COUNT-PREV = 1                             
  IF DATE-CURR NE DATE-PREV                                     
     RETURN-CODE = 16                                           
     STOP                                                       
  ELSE                                                           
     SEARCH MNTHTAB WITH DATE-CURR-MM GIVING REP-DATE-MM         
     MOVE DATE-PREV-DD TO REP-DATE-DD                           
     MOVE DATE-PREV-YY TO REP-DATE-YY                           
  END-IF                                                         
END-IF                                                           
*                                                             
*                                                             
END-PARA. PROC                                               
COUNT-TOT = SORTCURR:RECORD-COUNT + SORTPREV:RECORD-COUNT     
PRINT REPORT1                                                 
END-PROC                                                     
REPORT REPORT1 PRINTER REPORT1                               
TITLE 01 'FILE COMPARE REPORT'                               
TITLE 02 '-------------------'                               
LINE  01 '   '                                               
TERMINATION.   PROC                                           
DISPLAY 'HARDCODED TEXT1 ' REP-DATE  'HARCODED TEXT2'         
DISPLAY 'TOTAL RECORD COUNT IS:' COUNT-TOT                   
DISPLAY '     '                                               
DISPLAY 'RECORD COUNT ON CURR  IS:' SORTCURR:RECORD-COUNT     
DISPLAY '         '                                           
DISPLAY 'RECORD COUNT ON PREV  IS:' SORTPREV:RECORD-COUNT     
DISPLAY '     '                                               
DISPLAY '65 BYTE HARDCODED TEXT '                             

*********


change the file layout according to ur layout.

Vijay
Back to top
View user's profile Send private message
menon
Beginner


Joined: 06 Jun 2003
Posts: 2
Topics: 1

PostPosted: Fri Jun 06, 2003 9:50 am    Post subject: Reply with quote

Vijay, We do not have EZtrieve in our shop. Anybody know a DFSORT solution ? If we can't do this using sort then I would go for Cobol.
Thanks,
Menon.
Back to top
View user's profile Send private message
CaptBill
Beginner


Joined: 02 Dec 2002
Posts: 100
Topics: 2
Location: Pasadena, California, USA

PostPosted: Fri Jun 06, 2003 10:53 am    Post subject: Reply with quote

menon,

Do you have VISION:Results or DYL-280 in your shop? If you do and Frank or kolusu do not come up with a solution, you might want to try it.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Fri Jun 06, 2003 11:25 am    Post subject: Reply with quote

Menon,

Here's a DFSORT/ICETOOL job that uses DFSORT symbols to produce a report similar to what you want. STEP2 gives RC=0 if the dates match or RC=12 if the dates don't match.

I used ADD which is new in DFSORT R14 PTF UQ90053 (Feb, 2003). If you don't have that PTF, we could do the equivalent of the ADD another, more complicated way.

Note that I've used DFSORT editing masks to format the totals - you can use different editing masks if you want to change the way the totals look in the report.

Code:

//STEP1 EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//FILE1 DD *
1 Header Record 050603
2 Detail - 1
2 Detail - 2
2 Detail - 3
9 Trailer record 3
//FILE2 DD *
1 Header Record 060603
2 Detail - 1
2 Detail - 2
2 Detail - 3
2 Detail - 4
2 Detail - 5
9 Trailer record 5
//I1 DD DSN=&&I1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(MOD,PASS)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(MOD,PASS)
//S2 DD DSN=&&S2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(MOD,PASS)
//TOOLIN DD *
  COPY FROM(FILE1) USING(CTL1)
  COPY FROM(FILE2) USING(CTL2)
/*
//CTL1CNTL DD *
* Get File1 Header with 'ddmmyy' date for comparison
  OUTFIL FNAMES=I1,ENDREC=1
* Create DFSORT symbol as follows from ddmmyy date in File1 Header
*  F1DATE2,'month     dd,20yy'
  OUTFIL FNAMES=S1,REMOVECC,ENDREC=1,
    OUTREC=(C'F1DATE2,''',
      19,2,CHANGE=(9,C'01',C'January',C'02',C'February',
       C'03',C'March',C'04',C'April',C'05',C'May',C'06',C'June',
       C'07',C'July',C'08',C'August',C'09',C'September',
       C'10',C'October',C'11',C'November',C'12',C'December'),
       X,17,2,C', 20',21,2,C'''',80:X)
* Create DFSORT symbols as follows for File1 detail record count
*  F1TRLCT1,'nnn'
*  F1TRLCT2,+n
  OUTFIL FNAMES=S2,REMOVECC,NODETAIL,
    INCLUDE=(1,1,CH,EQ,C'2'),
    TRAILER1=(C'F1TRLCT1,''',COUNT=(EDIT=(IIT)),C'''',80:X,/,
              C'F1TRLCT2,',COUNT=(M26),80:X)
/*
//CTL2CNTL DD *
* Create DFSORT symbol as follows from ddmmyy date in File1 Header
*  F2DATE1,'ddmmyy'
  OUTFIL FNAMES=S1,REMOVECC,ENDREC=1,
    OUTREC=(C'F2DATE1,''',17,6,C'''',80:X)
* Create DFSORT symbols as follows for File2 detail record count
*  F2TRLCT1,'nnn'
*  F2TRLCT2,+n
  OUTFIL FNAMES=S2,REMOVECC,NODETAIL,
    INCLUDE=(1,1,CH,EQ,C'2'),
    TRAILER1=(C'F2TRLCT1,''',COUNT=(EDIT=(IIT)),C'''',80:X,/,
              C'F2TRLCT2,',COUNT=(M26),80:X)
/*
//STEP2 EXEC  PGM=ICETOOL
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//         DD DSN=&&S2,DISP=(OLD,PASS)
//SYMNOUT DD SYSOUT=*
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//I1 DD DSN=&&I1,DISP=(OLD,PASS)
//RPT DD SYSOUT=*
//TOOLIN DD *
* SET RC=0 IF FILE1 DATE MATCHES FILE2 DATE
* SET RC=12 IF FILE1 DATE DOES NOT MATCH FILE2 DATE
  COUNT FROM(I1) USING(CTL1) EMPTY
  COPY FROM(I1) USING(CTL2)
/*
//CTL1CNTL DD *
* COMPARE FILE1 'ddmmyy' date to previously created
* DFSORT symbol for FILE2 'ddmmyy' date
  INCLUDE COND=(17,6,CH,EQ,F2DATE1)
/*
//CTL2CNTL DD *
* Generate report using previously created DFSORT symbols
  OUTFIL FNAMES=RPT,
   OUTREC=(C'30 byte hard coded text',X,
     F1DATE2,X,
     C'20 byte hard coded text',80:X,/,
     C'Total record count is ',
      (F1TRLCT2,ADD,F2TRLCT2),EDIT=(IIT),//,
     C'Record count on File A is ',F1TRLCT1,//,
     C'Record count on File B is ',F2TRLCT1,//,
     C'65 byte hard coded text')
/*


Here's the report this produced:

Code:

30 byte hard coded text June      05, 2003 20 byte hard coded text
Total record count is   8                                         
                                                                   
Record count on File A is   3                                     
                                                                   
Record count on File B is   5                                     
                                                                   
65 byte hard coded text                                           

_________________
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
Page 1 of 1

 
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