Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M

Google
 
Web mainframegurukul.com

DFSORT - Overlay with multiple files - Help

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
JackOnRocks
Member


Joined: 03 Mar 2009
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 03, 2009 3:07 am    Post subject: DFSORT - Overlay with multiple files - Help Reply with quote

DISP=(NEW,CATLG,CATLG),
DCB=(MODLDSCB,LRECL=28672,RECFM=VB)


File 1: If '00000000' in position 869 and Y in pos 611, then pull date from file 2 and post to position 869. (@0365 SSN).

File 2: SSN, date


I need to merge the files by SSN and update File 1 if position 868 has '00000000' and position 611 has 'Y' otherwise output the record as is. I need the output file to be in the same order as the original file. Is it possible to use an overlay stmt that overlays the date from file 2 to position 869 in file 1 when the criteria is met?


Thanks in advance!
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 03, 2009 4:11 am    Post subject: Reply with quote

You can use an IFTHEN clause to do an OVERLAY if a WHEN condition is met.

Your description is too confusing for me to tell you how to do it. If you want more specific help, give an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input files. Give the starting position, length and format of each relevant field.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
JackOnRocks
Member


Joined: 03 Mar 2009
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 03, 2009 5:17 am    Post subject: Reply with quote

Sorry, hopefully this will make more sense.

File 1:
@0365 SSN (Char9)
@0869 Date (YYYYMMDD)
@0611 Flag (Char1)
VB LRECL=28672
900,000 records

File 2:
@0001 SSN (Char9)
@0025 Date (YYYYMMDD)
FB LRECL=80
600,000 records
(No duplicates)

The key to join both files is SSN. I need to update the Date variable on File 1 with the Date variable on File 2 using this criteria: (Date on File 1 = '00000000' and Flag = 'Y'). If the criteria is not met or the SSN on File 1 is NOT found in File 2, then the entire record should be sent to the output as is.

If in File 1 then do;
If File1.Date = '00000000' and File1.Flag ='Y' then do;
If ssn exist on file 2 then move File2.Date to File1.Date.
Output entire record;
Else;
Output entire record;
End;

File 1:
record 1:
@0365 SSN 111223333
@0869 Date 20081120
@0611 Flag Y

record 2:
@0365 SSN 111224444
@0869 Date 00000000
@0611 Flag Y

record 3:
@0365 SSN 111225555
@0869 Date 00000000
@0611 Flag Y


File 2:
record 1:
@0001 SSN 111223333
@0025 Date 20091005

record 2:
@0001 SSN 111225555
@0025 Date 20090227


Output:
record 1 (Entire Record from file 1):<---No action taken (date not ='00000000')
@0365 SSN 111223333
@0869 Date 20081120
@0611 Flag Y

record 2: (Entire record from file 1):<--No action taken (SSN doesn't exist in file 2, record gets outputted as is)
@0365 SSN 111224444
@0869 Date 00000000
@0611 Flag Y

record 3: (Entire record from file 1):<--File2.Date moved to File1.Date
@0365 SSN 111225555
@0869 Date 20090227
@0611 Flag Y
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 03, 2009 5:38 am    Post subject: Reply with quote

Ok, I think I understand.

A few more questions:

Can input file1 have duplicate SSN numbers?

Do the positions you gave for input file1 include the RDW in positions 1-4?
For example, does @365 for the SSN include the RDW, or is it really @369 when we add 4 bytes for the RDW?

The output file should only contain records from input file1 (not input file2) - right?

The output file should have RECFM=VB and LRECL=28672 like the input file - right?
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
JackOnRocks
Member


Joined: 03 Mar 2009
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 03, 2009 8:16 am    Post subject: Reply with quote

Can input file1 have duplicate SSN numbers?
They can have duplicate SSNs, but they will not have
@0869 Date
@0611 Flag
There may be other record types with SSN at position 365(+4).


Do the positions you gave for input file1 include the RDW in positions 1-4?
For example, does @365 for the SSN include the RDW, or is it really @369 when we add 4 bytes for the RDW?


Good question...The VB positions will need to be incremented by 4 to account for the RDW. Ex: 365 will need to be 369.

The output file should only contain records from input file1 (not input file2) - right?
Correct.

The output file should have RECFM=VB and LRECL=28672 like the input file - right?
Correct.

(Took me three times to get the requirements communicated...I should move into mangement!!!)

Thanks for you help!
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 03, 2009 11:04 pm    Post subject: Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (VB/28672)
//IN2 DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD LRECL=28672,DSN=...  output file (VB/28672)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(379,9,CH) KEEPNODUPS -
  WITH(5,1) WITH(7,8) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,4,5:C'BB',15:5)
//CTL2CNTL DD *
  OUTFIL FNAMES=T1,FTOV,BUILD=(1:C'VV',3:25,8,375:1,9)
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,
    IFTHEN=(WHEN=(5,2,CH,EQ,C'VB',AND,625,1,CH,EQ,C'Y',AND,
       883,8,CH,EQ,C'00000000'),
      OVERLAY=(883:7,8),HIT=NEXT),
    IFTHEN=(WHEN=ANY,BUILD=(1,4,15)),
    IFTHEN=(WHEN=NONE,BUILD=(1,4,15))
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
JackOnRocks
Member


Joined: 03 Mar 2009
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Mar 04, 2009 12:04 am    Post subject: Reply with quote

Mr. Yaeger,

Thank you so much for your reply. Pieces of this code kind of flew over my head. (Ok, most of it)!

If have a moment, would you mind just talking through whats going on in the CNTL1CNTL, CNTL2CNTL and CNTL3CNTL sections of the code? I really want to understand what is going on. This would help us out so much!

I really appreciate your time!
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Mar 04, 2009 12:25 am    Post subject: Reply with quote

CTL1CNTL - reformats the VB input records to look like this:

|RDW|BB|blanks|... ssn ... flag ... date1 |

BB is an id used to identify that the records came from file1. The blanks leave room in the spliced record for date2 from file2 (see below).

CTL2CNTL - reformats the FB input records as VB records to look like this:

|RDW|VV|date2| ... ssn|

VV is an id used to identify that the records came from file2. date2 will replace date1 when the conditions are met (see below).

ssn here is in the same positions as ssn in file1.

CTL3CNTL - the 'VB' id indicates records from file1 and file2 have matching ssns. The IFTHEN WHEN=(cond) clause replaces date1 with date2 when your conditions are satisfied. The IFTHEN WHEN=ANY clause removes the id and date1 fields for records that were updated (the original data now starts at position 5 again). The IFTHEN WHEN=NONE clause removes the id and date1 for all the other output records (the original data now starts at position 5 again).
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 10:33 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & 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

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Search Batch file-aid help 14 frenchman 31561 Mon Feb 01, 2016 10:23 pm
academyindia4 View latest post
No new posts File-Aid Help 3 Nicholas 21374 Mon Feb 01, 2016 10:22 pm
academyindia4 View latest post
No new posts Hi plz help me out 7 Guest 21197 Mon Feb 01, 2016 10:14 pm
academyindia4 View latest post
No new posts Need urgent HELP 4 Sulagna 12528 Mon Feb 01, 2016 1:39 am
academyindia4 View latest post
This topic is locked: you cannot edit posts or make replies. executing java program thru JCL 6 Guest 24809 Tue Feb 12, 2013 1:56 pm
Anuj Dhawan View latest post
 


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-3808.html