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 

Report of values from a file with header and details records

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


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Tue Mar 06, 2007 7:46 am    Post subject: Report of values from a file with header and details records Reply with quote

I have a file with several header and detail records(RECL=68,FB).Header starts with 1 in position 1 and deatils with 2 in post 1

Code:


NAME                 VALUE
------------------------------------------   
position 1-32      position 34-65


1100.20              MONEY                             
2ATTR1               RA                           
2ATTR2               19941231                         
2DATA                PRODFILE                             
2ATTR3               2F1397E200F0284A9188353B9C73BD44
2......              ............
1200.20              MONEY                             
2ATTR1               RA                           
2ATTR2               19941231                         
2DATA                PRODFILE                             
2ATTR3               2F1397E200F0284A9188353B9C73BD44
2......              ............
1300.20              MONEY                             
2ATTR1               RA                           
2ATTR2               19941231                         
2DATA                TESTFILE                             
2ATTR3               2F1397E200F0284A9188353B9C73BD44
2......              ............


I want to have a report of number of different values found for name DATA, The name DATA will be the same in all detail records, only the
value could change,example PRODFILE,TESTFILE,DCARDFILE ....

I want to have a report of number of different values found for name DATA.

DATA PRODFILE = 2
DATA TESTFILE = 1

And if the value of DATA is not distinct, like in this case, I want the step to have a return code greater than 0, else a 0.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Mar 06, 2007 9:27 am    Post subject: Reply with quote

Shuko try this


Code:

//SYSIN    DD *                                               
  INCLUDE COND=(1,5,CH,EQ,C'2DATA')                           
                                                             
  SORT FIELDS=(1,5,CH,A)                                     

  SUM FIELDS=(69,08,                                         
              77,08,                                         
              85,08),FORMAT=ZD

  INREC IFTHEN=(WHEN=INIT,                       
     OVERLAY=(69:24C'0')),                     
      IFTHEN=(WHEN=(34,08,CH,EQ,C'PRODFILE'), 
     OVERLAY=(69:C'00000001')),               
      IFTHEN=(WHEN=(34,08,CH,EQ,C'TESTFILE'), 
     OVERLAY=(77:C'00000001')),               
      IFTHEN=(WHEN=(34,09,CH,EQ,C'DCARDFILE'),
     OVERLAY=(85:C'00000001'))
 
  OUTFIL NULLOFL=RC4,
  INCLUDE=(69,08,ZD,EQ,77,08,ZD,AND,                   
           69,08,ZD,EQ,85,08,ZD),                             
                                                             
  OUTREC=(C'DATA PRODFILE  = ',69,08,/,                       
          C'DATA TESTFILE  = ',77,08,/,                       
          C'DATA DCARDFILE = ',85,08,/,                       
          80:X)                                               
/*


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
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: Tue Mar 06, 2007 11:05 am    Post subject: Reply with quote

Kolusu,

I don't understand your example. It didn't seem to work when I tried it. Unless I'm missing something, SORT FIELDS=(1,5,CH,A) and SUM FIELDS=NONE will result in only one record for '2DATA', so I don't see how it can work.

Shuko,

I believe the following DFSORT job would give the needed report:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
 INCLUDE COND=(1,5,CH,EQ,C'2DATA')
 SORT FIELDS=(34,10,CH,A)
 OUTFIL REMOVECC,NODETAIL,
   SECTIONS=(34,10,
     TRAILER3=(C'DATA ',34,10,C' = ',COUNT=(M10,LENGTH=5)))
/*


SORTOUT would have:

Code:

DATA PRODFILE   =     2 
DATA TESTFILE   =     1 


Quote:
And if the value of DATA is not distinct, like in this case, I want the step to have a return code greater than 0, else a 0.


I don't understand what you mean by this. Please explain in more detail what you want.
_________________
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
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Mar 06, 2007 11:12 am    Post subject: Reply with quote

Frank Yaeger wrote:
Kolusu,

I don't understand your example. It didn't seem to work when I tried it. Unless I'm missing something, SORT FIELDS=(1,5,CH,A) and SUM FIELDS=NONE will result in only one record for '2DATA', so I don't see how it can work.


Frank,

I am actually summing on the constants I put at the end. Basically the requirement is to check the counts of "prodfile, testfile and dcardfile". If the count of all these are equal then set the return code to zero and if they don't match then you need to set the return code to greater than zero.

So I used IFTHEN to populate constants based on the character found at 34 and Summing on the constants to get 1 single record and using include cond on the OUTFIL I am comparing the counts.

Hope this clears

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


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Tue Mar 06, 2007 1:30 pm    Post subject: Reply with quote

Quote:

And if the value of DATA is not distinct, like in this case, I want the step to have a return code greater than 0, else a 0.


Frank

I just want to ensure that the first value found for DATA is the same for each of the following detail records with the name DATA. In my example I have DATA PRODFILE=2 and DATA TESTFILE =1, here a return code > 0.
(expected DATA PRODFILE and not DATA TESTFILE)

If I had DATA PRODFILE=3 and no DATA TESTFILE, then a return code = 0.
(All DATA values are the same). I just hope I expressed myself properly.

Thank you
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Mar 06, 2007 1:50 pm    Post subject: Reply with quote

shuko,

What is the return code if you had DATA TESTFILE=3 and no DATA PRODFILE ? Similary what is the return code it you had only DCARDFILE and no TEST/PROD file?

If the same rules apply as you mentioned for PRODFILE, then following JCL will give you the desired results.

Code:

//SYSIN    DD *                               
  INCLUDE COND=(1,5,CH,EQ,C'2DATA')           
                                               
  SORT FIELDS=(1,5,CH,A)                       
  SUM FIELDS=(69,08,                           
              77,08,                           
              85,08),FORMAT=ZD                 
  INREC IFTHEN=(WHEN=INIT,                     
     OVERLAY=(69:24C'0')),                     
      IFTHEN=(WHEN=(34,08,CH,EQ,C'PRODFILE'), 
     OVERLAY=(69:C'00000001')),               
      IFTHEN=(WHEN=(34,08,CH,EQ,C'TESTFILE'), 
     OVERLAY=(77:C'00000001')),               
      IFTHEN=(WHEN=(34,09,CH,EQ,C'DCARDFILE'),
     OVERLAY=(85:C'00000001'))                 
                                               
  OUTFIL NULLOFL=RC4,                         
  INCLUDE=((69,08,ZD,EQ,77,08,ZD,AND,         
            69,08,ZD,EQ,85,08,ZD),OR,         
           (69,08,ZD,GT,0,AND,                 
            77,08,ZD,EQ,0,AND,                 
            85,08,ZD,EQ,0),OR,                 
           (69,08,ZD,EQ,0,AND,                 
            77,08,ZD,GT,0,AND,                 
            85,08,ZD,EQ,0),OR,                 
           (69,08,ZD,EQ,0,AND,                 
            77,08,ZD,EQ,0,AND,                 
            85,08,ZD,GT,0)),                   
                                               
  OUTREC=(C'DATA PRODFILE  = ',69,08,/,       
          C'DATA TESTFILE  = ',77,08,/,       
          C'DATA DCARDFILE = ',85,08,         
          80:X)                               
/*                                             


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
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: Tue Mar 06, 2007 3:57 pm    Post subject: Reply with quote

Quote:
I am actually summing on the constants I put at the end. Basically the requirement is to check the counts of "prodfile, testfile and dcardfile". If the count of all these are equal then set the return code to zero and if they don't match then you need to set the return code to greater than zero.

So I used IFTHEN to populate constants based on the character found at 34 and Summing on the constants to get 1 single record and using include cond on the OUTFIL I am comparing the counts.


Kolusu,

Sorry, don't know why I got it in my head that you were using SUM FIELDS=NONE.

However, I thought the idea was to get the report regardless of whether RC=0 or RC=4 should be passed back. When I ran your original job, I didn't get the report lines. That's because the counts in your single output record are 2, 1 and 0, so the OUTFIL INCLUDE deletes that single record and the OUTREC has no record to operate against.

Seems like we could just produce the report with SECTIONS and then process that output to determine when to set RC=0 or RC=4 (a tad more processing, but perhaps simpler conceptually) . But I can't figure out from shuko's explanation when he wants RC=0 or RC=4, so I'll leave it to you.
_________________
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
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Wed Mar 07, 2007 1:45 am    Post subject: Reply with quote

Thank you Frank,Kolusu for your help.
Back to top
View user's profile Send private message
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