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 

Reporting lateral file merge

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


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Tue Mar 01, 2005 4:29 pm    Post subject: Reporting lateral file merge Reply with quote

I need to do a lateral merge of 2 files which have the same layout.

The structure is

For File1:
-----------
1. Date - ccyymmdd
2. Record key
3. Old amt - 9(10)v9(8)

For File2:
-----------
1. Date - same format
2. Record key
3. New amt - 9(10)v9(8)

The O/P file should be in a report format such as
REPORT HEADING DATE:----
PAGE:----
DATE FROM FILE2 SHOULD COME HERE as a heading

OLDAMT NEWAMT DIFFERENCE %VARIANCE

I'm able to do this in SORT(with splice) but I was not sure what would the SECTIONS i should be using for getting a page break. Also, i got confused with the reporting parms. So, please help with the sort job. Also, Please let me know if there is any way in EASYTRIEVE as well..
________
vaporizer volcano


Last edited by coolman on Sat Feb 05, 2011 1:39 am; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Tue Mar 01, 2005 8:09 pm    Post subject: Reply with quote

Quote:
I'm able to do this in SORT(with splice) but I was not sure what would the SECTIONS i should be using for getting a page break.


Well, that would depend on what you want to break on in the report. Your description of the input and output is rather sketchy. Please provide more details. Show an example of the input records with actual values and what you want the output report to look like (for more than one page). Indicate the starting position, length and format of the key, and the length of the various fields for input and output.

Show your "SORT(with splice)" job so we know what you've done so far.
_________________
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
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Mar 02, 2005 10:12 am    Post subject: Reply with quote

Code:

//STEP010  EXEC PGM=ICETOOL                                       
//*PREV.DAY                                                       
//IN1      DD DISP=SHR,DSN=INPUT.1
//*CURR.DAY                                                       
//IN2      DD DISP=SHR,DSN=INPUT.2
//*T1      DD SYSOUT=*                                             
//T1       DD DISP=(,PASS),DSN=&T1,UNIT=SYSDA,SPACE=(TRK,(5,5))   
//T2       DD DISP=(,PASS),DSN=&T2,UNIT=SYSDA,SPACE=(TRK,(5,5))   
//T3       DD DISP=(,PASS),DSN=&T3,UNIT=SYSDA,SPACE=(TRK,(5,5))   
//*T2      DD SYSOUT=*                                             
//CON      DD DISP=(OLD,PASS),DSN=&T1,VOL=REF=*.T1                 
//         DD DISP=(OLD,PASS),DSN=&T2,VOL=REF=*.T2                 
//DFSMSG   DD SYSOUT=*                                             
//TOOLMSG  DD SYSOUT=*                                             
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
*COPY PREV. FILE TO T1                                             
  COPY FROM(IN1)  TO(T1) USING(CTL0)                               
*REMOVE DUPLICATES FROM CURR. FILE                                 
  SORT FROM(IN2) TO(T2) USING(CTL1)                           
*SPLICE THIS FILE WITH CURR.FILE                             
 SPLICE FROM(CON) TO(T3) ON(1,11,CH)  WITH(12,8) WITH(60,18) 
 COPY FROM(T3) TO(OUT) USING(CTL3)                           
/*                                                           
//CTL0CNTL DD *                                               
  OUTREC FIELDS=(12,11,40:113,18,80:X)                       
/*                                                           
//CTL1CNTL DD *                                               
  SORT FIELDS=(12,11,CH,A)                                   
  SUM FIELDS=NONE                                             
  OUTREC FIELDS=(12,11,3,8,60:56,18,80:X)                     
/*                                                           
//CTL3CNTL DD *                                               
 OUTFIL REMOVECC,                                             
 HEADER1=(2/,35:'REPORT ',75:'DATE:',&DATE,/,                 
           133:X),                                           
  SECTIONS=(1,1,SKIP=P,                             
                  HEADER3=(60:'PAGE:',&PAGE,/,       
       5:'PREV.DAY BALANCE', 24:'CURR.DAY BALANCE', 
       40:'DIFFERENCE',60:'VARIANCE')),             
       OUTREC=(5:40,18,24:60,18,133:X)               
/*                                                   



Both IN1 and IN2 have the same layouts. The LRECL is 150 and RECFM is FB.
The key begins at 12th postion and is of length 11. File1 contains an old amt which is at postion 113 and is of length 18. File2 contains an new amt which is at posn 56 and is of length 18. The objective is to have report which would be like as shown under

3/01/2005 DISCREPANCY REPORT #1 - 20040429
-------------------------------------

PREVIOUS BALANCE CURRENT BALANCE DIFFERENCE %V
---------------- ---------------- ------------ ---------- ------
1,558.30700000 1,461.58940000 96.71760000 6.2
4,996.78180000 2,272.68700000 2,724.09480000 54.5
973.53900000 880.44200000 93.09700000 9.6

and so on..


I have written an EZT job for the same and have generated this report yesterday. But, I have one small issue there. How do we have an edit mask that accomodates a negative sign. In sort, we have EDIT=(ZZZZ),SIGNS=(+,-) which would accomodate the sign. How could this be accomplished in EZT.

As always, thanks Frank for your prompt response.
________
Ipad guide


Last edited by coolman on Sat Mar 12, 2011 8:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Mar 02, 2005 10:15 am    Post subject: Reply with quote

oops...missed out on the SECTIONS. I know that for a SECTIONS statement be based on the control break in the report. But, in this case, I really don't want to do anything like control summary addition. All I want is after every page, the header needs to be repeated and the detail records follow suit.
________
T500


Last edited by coolman on Sat Feb 05, 2011 1:40 am; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Mar 02, 2005 1:20 pm    Post subject: Reply with quote

Coolman,

Post a sample of yout input and I will show a way to do it !

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Mar 02, 2005 3:42 pm    Post subject: Reply with quote

Kolusu,

I have finished it off in Easytrieve. I will post the i/p and o/p soon. It's simple but since I don't know ezt all that well, took me some extra time.

Tx for your help.

I will also post the EZTREIVE soln when I post the I/p and O/p

Thanks everyone.
________
vaporizer reviews


Last edited by coolman on Sat Feb 05, 2011 1:40 am; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Mar 02, 2005 7:08 pm    Post subject: Reply with quote

Let's assume the input looks like this:

Code:

1          12               113
20041101   AAAAAAAAAAA ...  123456789012345678
20041101   BBBBBBBBBBB ...  000000155830700000
20041101   CCCCCCCCCCC ...  000000499678180000
20041101   DDDDDDDDDDD ...  000000097353900000

Input file2

1          12               56
20041105   AAAAAAAAAAA ...  034567890123456789
20041105   BBBBBBBBBBB ...  000000146158940000
20041105   BBBBBBBBBBB ...  000000001200000000
20041105   CCCCCCCCCCC ...  000000227268700000
20041105   CCCCCCCCCCC ...  000000050000002345
20041115   DDDDDDDDDDD ...  000000088044200000


Since the ZD fields are 18 bytes, we need the new larger number support in z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004). Without the Dec, 2004 PTF, DFSORT only supported up to 15-digit ZD values for certain functions such as arithmetic expressions. With the Dec, 2004 PTF, DFSORT supports up to 31-digit ZD values for all functions. (Note that the job below won't work with Syncsort because Syncsort does NOT have the support for larger numbers that DFSORT has).

That said, here's the DFSORT/ICETOOL job to do what you want. Note that since you only want page headings, we can use HEADER2. We don't need SECTIONS since you're not using section breaks.

Code:

//S1  EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD DSN=... input file1
//IN2      DD DSN=... input file2
//T1       DD DSN=&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),
//*** USE MOD FOR T1
//  DISP=(MOD,PASS)
//OUT      DD SYSOUT=*
//TOOLIN   DD *
* IN1->T1:  Reformat for SPLICE
  COPY FROM(IN1)  TO(T1) USING(CTL1)
* IN2->T1:  Remove dups and reformat for SPLICE
  SELECT FROM(IN2) TO(T1) ON(12,11,CH) FIRST USING(CTL2)
* T1->OUT:  Splice records to get:
* |date.|key|prev.|current|
* Produce the report from these values.
 SPLICE FROM(T1) TO(OUT) ON(11,11,CH) -
   WITH(1,8) WITH(51,18) USING(CTL3)
/*
//CTL1CNTL DD *
* |blank|key|prev.|blank..|
  OUTREC FIELDS=(11:12,11,31:113,18,51:18X)
/*
//CTL2CNTL DD *
* |date.|key|blank|current|
  OUTFIL FNAMES=T1,OUTREC=(1:1,8,11:12,11,51:56,18)
/*
//CTL3CNTL DD *
 OUTFIL FNAMES=OUT,REMOVECC,
 HEADER2=(/,X,/,DATE=(MD4/),28:'DISCREPANCY REPORT #1 -',
   5X,1,8,/,28:36C'-',/,X,/,
   'PREVIOUS BALANCE',28:'CURRENT BALANCE',
   55:'DIFFERENCE',82:'%DIFF',/,
   22C'-',28:22C'-',55:22C'-',82:5C'-'),
 OUTREC=(31,18,ZD,EDIT=(I,III,III,IIT.TTTTTTTT),
      28:51,18,ZD,EDIT=(I,III,III,IIT.TTTTTTTT),
      55:31,18,ZD,SUB,51,18,ZD,
            EDIT=(I,III,III,IIT.TTTTTTTT),
      82:((31,18,ZD,SUB,51,18,ZD),MUL,+1000),DIV,31,18,ZD,
            EDIT=(IIT.T))
/*


OUT would have:

Code:


03/02/2005                 DISCREPANCY REPORT #1 -     20041105
                           ------------------------------------

PREVIOUS BALANCE           CURRENT BALANCE            DIFFERENCE                 %DIFF
----------------------     ----------------------     ----------------------     -----
1,234,567,890.12345678       345,678,901.23456789       888,888,988.88888889      72.0
        1,558.30700000             1,461.58940000                96.71760000       6.2
        4,996.78180000             2,272.68700000             2,724.09480000      54.5
          973.53900000               880.44200000                93.09700000       9.5


Wow, wouldn't we all like to have that first balance. Laughing

Note: I had to stretch my browser window as wide as it would go to to get the report to display correctly.
_________________
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


Last edited by Frank Yaeger on Thu Mar 03, 2005 5:37 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Thu Mar 03, 2005 4:53 pm    Post subject: Reply with quote

Good work Franks. As always, Thank you very much.
________
buy grinders


Last edited by coolman on Sat Feb 05, 2011 1:40 am; edited 1 time in total
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Thu Mar 03, 2005 4:55 pm    Post subject: Reply with quote

Quick Q Frank - Would this job split up into multiple pages if there are 1000+ records in the i/p. The reason for my asking is that it does not have SECTIONS which is where I faced issues.
________
Toyota Corolla E140 history


Last edited by coolman on Sat Feb 05, 2011 1:40 am; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Thu Mar 03, 2005 5:35 pm    Post subject: Reply with quote

Yes, it would. Page breaks are controlled by LINES=n (DFSORT's default is LINES=60).

You're confusing page breaks and section breaks. LINES=n controls the number of lines per page. When you get n lines on a page, DFSORT will start a new page.

HEADER2 sets up the page headers and TRAILER2 sets up page trailers. Whenever DFSORT starts a new page (after n lines), the HEADER2 lines are printed at the top of the page. The TRAILER2 lines are printed at the bottom of the page before we start a new page.

SECTIONS sets up a section break whenever the key (p,m) changes. SKIP=P can be used to start a new page for each section. SKIP=nL can be used to insert n lines between sections on the same page. HEADER3 and TRAILER3 set up section headers and section trailers. You don't need to use SECTIONS to set up page breaks - LINES=n will set up the page breaks. But you can use SECTIONS and SKIP=P to set up section breaks and start each section on a new page if you want to.
_________________
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