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 

create dfsort report of changes and a file of new adds
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
tlhceh
Beginner


Joined: 21 Nov 2006
Posts: 6
Topics: 1
Location: Central Illinois

PostPosted: Wed Jun 04, 2008 1:20 pm    Post subject: create dfsort report of changes and a file of new adds Reply with quote

I am comparing todays file to yesterdays file and I need to create a simple report of any record that changes and file of any new records. In the file of new records I need to change the value of positions 41 and 39 from a 0 to 1. Can this be done utilizing DFSORT ??In one step??? In my COBOL mind this is short program but I am still learning the newer features of DFSORT. My file has a length of 41 and is keyed on position 3 for length of 9.

Todays file:
Code:

C;123456789;00600;01901;18;++00015000;0;0
C;234567891;00600;01901;18;++00015000;0;0
C;345678912;00600;01901;18;++00015000;0;0
C;456789123;00600;01901;18;++00015000;0;0
C;567891234;00600;01901;18;++00015000;0;0
C;678912345;00600;01901;18;++00015000;0;0
C;789123456;00600;01901;18;++00015000;0;0
C;912345678;00600;01901;18;++00015000;0;0


yesterdays file:
Code:

C;123456789;00601;01758;18;++00022500;0;0
C;234567891;00600;01901;18;++00015000;0;0
C;345678912;00625;01992;18;++00030000;0;0
C;456789123;00600;01901;18;++00015000;0;0
C;567891234;00652;00825;18;++00012500;0;0


In this example I would expect records 1,3 and 5 to be on the report and records 6,7 and 8 to be in the new file with postion 39 and 41 now a 1 instead of 0. Nothing would happen to records 2 and 4 as they stayed the same.

new file:
Code:

C;678912345;00600;01901;18;++00015000;1;1
C;789123456;00600;01901;18;++00015000;1;1
C;912345678;00600;01901;18;++00015000;1;1


The change,if any, will be indicated by postion 13 for length of 5. On the simple report of changed records I need postion 3 for length of 9 and postion 13 for length of 5 from both files.

Any help is appreciated.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 04, 2008 2:44 pm    Post subject: Reply with quote

tlhceh,

The following DFSORT JCL will give you the desired results. concatenate both today's and yesterday's file together and run the job

Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN=your today's file,disp=shr
//           DD DSN=your yesterdays file,disp=shr                             
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//RPT      DD SYSOUT=*                                               
//NEW      DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
  SELECT FROM(IN) TO(T1) ON(1,18,CH) NODUPS                           
  SELECT FROM(T1) TO(RPT) ON(1,12,CH) ALLDUPS DISCARD(NEW) USING(CTL1)
//CTL1CNTL DD *                                                       
  OUTFIL FNAMES=RPT                                                   
  OUTFIL FNAMES=NEW,BUILD=(1,38,C'1;1')                               
//*                                                                   


The output from the above job is
New File
Code:

C;678912345;00600;01901;18;++00015000;1;1
C;789123456;00600;01901;18;++00015000;1;1
C;912345678;00600;01901;18;++00015000;1;1


RPT File
Code:

C;123456789;00600;01901;18;++00015000;0;0
C;123456789;00601;01758;18;++00022500;0;0
C;345678912;00600;01901;18;++00015000;0;0
C;345678912;00625;01992;18;++00030000;0;0
C;567891234;00600;01901;18;++00015000;0;0
C;567891234;00652;00825;18;++00012500;0;0

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


Joined: 21 Nov 2006
Posts: 6
Topics: 1
Location: Central Illinois

PostPosted: Thu Jun 05, 2008 9:56 am    Post subject: Reply with quote

Thanks Kolusu I will be implementing this in the next few days. I see in your example that it only creates a file to be used in creating a report. Can this same step create the the report or do I take from your example and make a second step to utilize ICETOOL to make the report. I know I can do this with a second step utilizing the RPT file but I am curious if it could be done in one step. Thank you for your assistance.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 05, 2008 10:41 am    Post subject: Reply with quote

tlhceh,

I think it can be done in the same step. How do you want the report to look like?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tlhceh
Beginner


Joined: 21 Nov 2006
Posts: 6
Topics: 1
Location: Central Illinois

PostPosted: Thu Jun 05, 2008 11:51 am    Post subject: Reply with quote

header one is postion 3 for length of 9 and header 2 is from new (todays)file postion 13 for length of 5 and header three is from old (yesterdays) file postion 13 for length of 5
Code:

Header 1              header 2        header 3
123456789              600                601
345678912              600                625
567891234              600                652
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 05, 2008 12:34 pm    Post subject: Reply with quote

tlhceh,

Change your CTL1CNTL to the following and re-run the job.

Code:

//CTL1CNTL DD *                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(42:SEQNUM,1,ZD,RESTART=(1,12))),
  IFTHEN=(WHEN=(42,1,ZD,EQ,2),OVERLAY=(43:13,5,13:5C'0'))         
  OUTFIL FNAMES=RPT,REMOVECC,NODETAIL,                             
  HEADER1=(3:'KEY FIELD',2X,'TODAY',2X,'YESTERDAY',/,             
           3:'=========',2X,'=====',2X,'=========',/),             
  SECTIONS=(1,12,                                                 
  TRAILER3=(3:3,9,2X,TOT=(13,5,ZD,M10,LENGTH=5),2X,               
            TOT=(43,5,ZD,M10,LENGTH=5)))                           
  OUTFIL FNAMES=NEW,BUILD=(1,38,C'1;1')                           
//*                                                               


The output is as follows
Code:

  KEY FIELD  TODAY  YESTERDAY
  =========  =====  =========
                             
  123456789    600    601   
  345678912    600    625   
  567891234    600    652   

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


Joined: 15 Jun 2007
Posts: 3
Topics: 0

PostPosted: Wed Jun 18, 2008 11:02 am    Post subject: Reply with quote

Kolusu

Your first example was successful, however the second one when changing the CTL1CNTL to your code gave me a S0C7 saying "UNSUCCESSFUL SORT" in the JESYSMSG

Any ideas?

Thanks!
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 18, 2008 11:07 am    Post subject: Reply with quote

DeaconEx,

S0C7 is usually due to invalid Numeric fields. Show me the cobol layout of the file and we will help you with the control cards


kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DeaconEx
Beginner


Joined: 15 Jun 2007
Posts: 3
Topics: 0

PostPosted: Wed Jun 18, 2008 11:33 am    Post subject: Reply with quote

Kolusu

Here is my record layout:
Code:
01  AGENT_REC.
      05  AGT_ID     PIC X(7).
      05  FILLER     PIC X(4).
      05  COMM_IND   PIC X(1).
      05  FILLER     PIC X(1).
      05  DISP       PIC X(1).



LAST MONTH - INPUT
Code:
----+----1----+
1234500    Y O
1234567    Y O
233522     N I
3456       Y I
376748     Y O
320415     Y O
999584     N O


THIS MONTH - INPUT
Code:
----+----1----+
1234500    Y O
1234567    Y I
233522     N I
3456       Y O
376748     Y O
320415     Y O
5678912    N I
999584     N O


REPORT FILE - OUTPUT
Code:
  AGENT ID  THIS MONTH  LAST MONTH
  ========  ==========  ==========
  1234567   Y I         Y O
  3456      Y O         Y I
  5678912   N I
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 18, 2008 12:03 pm    Post subject: Reply with quote

DeaconEx,

This is completely different from what you have shown earlier. There are no numeric fields in here. You just cant use the same job.

Try this

Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN=your this month's file,disp=shr
//         DD DSN=your last month's file,disp=shr
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//RPT      DD SYSOUT=*           
//TOOLIN   DD *                                                       
  SELECT FROM(IN) TO(T1) ON(1,14,CH) NODUPS                           
  SORT FROM(T1) USING(CTL1)                                           
//CTL1CNTL DD *                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,14,5Z,SEQNUM,1,ZD,RESTART=(1,11))),
  IFTHEN=(WHEN=(20,1,ZD,EQ,2),OVERLAY=(16:12,3,Z,12:4Z))             
  SORT FIELDS=(1,11,CH,A)                                             
  SUM FIELDS=(12,4,BI,16,4,BI)                                       
  OUTREC BUILD=(1,11,12,8,TRAN=ALTSEQ,35:X)                           
  ALTSEQ CODE=(0040)                                                 
  OUTFIL FNAMES=RPT,REMOVECC,                                         
  BUILD=(1:1,11,13:12,3,25:16,3,35:X),                               
  HEADER1=('AGENT ID    THIS MONTH  LAST MONTH',/,                   
           '========    ==========  ==========')                     
/*                                                                   


The output from this job is
Code:

AGENT ID    THIS MONTH  LAST MONTH
========    ==========  ==========
1234567     Y I         Y O       
3456        Y I         Y O       
5678912     N I                   

Hope this helps...

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


Joined: 15 Jun 2007
Posts: 3
Topics: 0

PostPosted: Wed Jun 18, 2008 1:00 pm    Post subject: Reply with quote

Kolusu

Thanks so much for this!!! It works beautifully ... the one thing that kind of stood out though was the second record Agent_ID = 3456. The data is in reverse, it should be "Y O" for this month and "Y I" for last month, shouldn't it???

Thanks,

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


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

PostPosted: Wed Jun 18, 2008 1:29 pm    Post subject: Reply with quote

DeaconEx wrote:
Kolusu

Thanks so much for this!!! It works beautifully ... the one thing that kind of stood out though was the second record Agent_ID = 3456. The data is in reverse, it should be "Y O" for this month and "Y I" for last month, shouldn't it???

Thanks,

DeX


Well we are sorting on the Entire length of the record(14 bytes) in the first pass and eliminating dups. So a "Y I" record would be sorted before "Y O" record . And the last 3 characters dictate if the record is a duplicate or not. If you really want to distinguish then we need to process each file separately adding an indicator to them and then get the results. If that is what you need then let me know I will show a way to get the results

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


Joined: 21 Nov 2006
Posts: 6
Topics: 1
Location: Central Illinois

PostPosted: Thu Jun 26, 2008 2:28 pm    Post subject: Reply with quote

Kolusu

Is there a way to insert the actual date in the report heading instead of "Today" and Yesterday"? I have tried utilizing a few examples but get a syntax error. The examples I found all have "on (position number, length, format) and I am not sure I can use this with this example you provided. Can you assist?

Thank you

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


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

PostPosted: Thu Jun 26, 2008 3:21 pm    Post subject: Reply with quote

tlhceh,

What do you mean actual dates? Do you want to pick dates within the file or you actually want the current date and yesterday's date as header?

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tlhceh
Beginner


Joined: 21 Nov 2006
Posts: 6
Topics: 1
Location: Central Illinois

PostPosted: Thu Jun 26, 2008 5:08 pm    Post subject: Reply with quote

kolusu wrote:
tlhceh,

What do you mean actual dates? Do you want to pick dates within the file or you actually want the current date and yesterday's date as header?

Kolusu


Yes actual dates for the header and they should be current date and yesterday's date.

Thanks
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
Goto page 1, 2  Next
Page 1 of 2

 
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