View previous topic :: View next topic
|
Author |
Message |
premnath
New User
Joined: 08 Jan 2006 Posts: 15
|
|
|
|
File1:(VB/600 length)
Header1 ==> Identified by X'22003A' in position 19 ->Key info available here
Rec1 - No update
Rec2 ==> identified by X'153A27' in position 19 (This where final update should happen)
Rec3 ==> identified by X'153A27' in position 19 (This where final update should happen)
Rec4 ==>- No update
Trailer1 ==> dynamic position wherever we get X'220D0A'
Header2 ==> Identified by X'22003A' in position 19 ->Key info available here
Rec1 -- No update
Rec2 ==> identified by X'153A27' in position 19 (This where final update should happen)
Rec3 ==> identified by X'153A27' in position 19 (This where final update should happen)
Rec4 ==> identified by X'153A27' in position 19 (This where final update should happen)
Rec5- No update
Rec6 - No update
Trailer2 ==> dynamic position wherever we get X'220D0A'
Header3 ==> Identified by X'22003A' in position 19 ->Key info available here
Rec1- No update
Rec2 ==> identified by X'153A27' in position 19 (This where final update should happen)
Trailer3 ==> dynamic position wherever we get X'220D0A'
File 2:(VB/600)
Header1 ==> Identified by X'22003A' in position 19
Rec1: ==> identified by X'153A28' in position 19 -->Key info available here
Rec2
Trailer1 ==> dynamic position wherever we get X'220D0A'
Header2 ==> Identified by X'22003A' in position 19
Rec1:-
Rec2:==> identified by X'153A28' in position 19-->Key info available here
Trailer2 ==> dynamic position wherever we get X'220D0A'
Requirement: Compare File1(header info) and File 2(detail info) based on below criteria and update file1 with information that is
fetched from file 2
Comparison Positions :
File 1(Key info available in Header in below positions)
Pos 1 To Pos 4: eg:X'1537'(STORE NUM)
Pos_22 To Pos_23 : eg:X'0668'(Terminal Number)
Pos_30 To Pos_31 eg:X'0079'(Transac Num)
Pos 28 To Pos 39 X'TT0000000001' (token)
Pos 43 X'59'(Indicator y/n)
File 2(Key info available in detail record in below positions)
Pos 24 To Pos 25 X'1537'(STORE NUM)
Pos 27 To Pos 28 X'0668'(Terminal Number)
Pos 30 To Pos 31 X'0079'(Transac Num)
Pos 37 To Pos 48 X'TT0000000001' (token)
Pos 50 To Pos 61 X'PP0000000001'(This is not key to compare ,this is data for updation in file 1 when a match found)
Condition to be coded
IF <Pos 1 To Pos 4> OF fILE 1 header record = <Pos 24 To Pos 25> of file 2 Detail record
AND <Pos_22 To Pos_23> OF fILE 1 header record = <Pos 27 To Pos 28> of file 2 Detail record
AND <Pos_30 To Pos_31> OF fILE 1 header record = <Pos 30 To Pos 31> of file 2 Detail record
AND <Pos_28 To Pos_39> OF fILE 1 header record = <Pos 37 To Pos 48> of file 2 Detail record
AND Pos_43 OF fILE 1 header record = X'59'(INDICATOR 'Y')
THEN
Move <Pos 50 To Pos 61> of Matched detail record(From File2) TO <Pos 28 To Pos 39 OF DETAIL record>(To File1)
MOVE indicator value 'N' (hex) in Pos 43 of File 1(Detail record)
END-IF
Note :
Header of file1 Identified by X'22003A' in position 19
Detail of file1 Identified by X'153A27' in position 19
Header of file2 Identified by X'22003A' in position 19
Detail of file2 Identified by X'153A28' in position 19
I tried writing a cobol program for this ,But could not get full expected results as i was able to update only one record in group
if multiple details record has to be updated in a group i was unable to .Looking if there is a better way in dfsort/icetool. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
What have you tried? Please supply input/ouTput examples that actually look like your input and desired output - using the code tags to preserve spacing. Please use 'dataset' rather than 'file' as data is stored in datasets, not in files. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Nic,
I was just thinking about this for some reason, and again you request the use of 'dataset' rather than 'file'.
I realize you are a global moderator with 2419 posts, but consider the possibility that you are incorrect on this point.
For this solution the user would use DFSORT, but in my example I must refer to the Syncsort manual as that is what I have handy.
Here is a snippet from the manual. Notice the reference to the word FILE several times. I searched the manual and the word FILE came up 532 times. The word dataset came up ZERO times.
What does that tell you?
The designer of the product refers to the collection of data as a FILE.
Why can't you?
Use the JOINKEYS statement to enable join feature processing and to identify the fields used to select records for join processing.
The join feature joins records from two input files that are specified on the SORTJNF1 and SORTJNF2 DD statements. By default, when the JOINKEYS fields from m records in SORTJNF1 match the JOINKEYS fields from n records in SORTJNF2, all combinations of the records are joined using the REFORMAT statement, producing m*n records as input to subsequent MFX processing. (This is called an “inner join.”)
The input files do not need to be presorted or have the same record type.
Two JOINKEYS control statements are required – one for each of the two files used in the join. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2145 Location: USA
|
|
|
|
The question from NicC remains the same: what have you tried?
You typed tons of words, mainly meaningless, but did not present your own attempt to approach any solution, even a minor one. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Quote: |
You typed tons of words, mainly meaningless, but did not present your own attempt to approach any solution, even a minor one. |
I disagree entirely. My goal was not to provide a solution for the TS issue. I am sure many other here can and will do that.
My goal was to try to stop an Expert on this forum from providing incorrect information as gospel.
A new user will see his incorrect assertion, then go to the manual looking for a reference for dataset, and find none. Instead they will find the word file referred to hundreds of times.
The purpose of this forum is not only provide solutions to questions, but properly educate.
Repeatedly saying the reference to a collection of data as a file is incorrect, is improperly educating the newer users in the community.
I wish experts such as your self would back me up on this.
But alas no. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Let us just focus on the problem than getting into files va Data set because I remember we hav had discussed this so many times in past and outcome is many would prefer both and some will prefer ONLY Dataset , so let us leave that choice to an individual what to use.
ibmmainframes.com/about66687.html
Besides , TS after 14 years in the forum don’t use code tags nor show us sample input and expected output data In neat way doesn’t get to any help so easily. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Quote: |
so let us leave that choice to an individual what to use.
|
I agree 100%. If it is a choice, then a moderator should not tell them otherwise.
I will continue to share my opinion every time it is warranted. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Technically its still a Data Set on zOS but I don't disagree if someone make a use of Files instead since IBM Manuals too refer many a time a file and Data set interchangeably. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
Besides the discussion to call datasets also files, I would like to see some input data here to play around with. |
|
Back to top |
|
|
premnath
New User
Joined: 08 Jan 2006 Posts: 15
|
|
|
|
Hi ,
Kindly ignore my previous request and consider this which is similar .By mistake posted it in different topic .Not sure about deleting that one
Need some help here in Group comparison .Your help will be much appreciated .Below is the details
Input file1 Type:VB
Input file2 Type:VB
Output file1 type :VB
Output file2 type :VB
All files Length:600
Input file1 Header identifier :X'22003A' in Position 19
Input file1 Trailer identifier: X'220D0A' it could be at any position after any number of records .Whenever
we encounter X'220D0A' that is identified as trailer record for those group of records .
Input file2 Header identifier :X'22003A' in Position 19
Input file2 Trailer identifier: X'220D0A' it could be at any position after any number of records .Whenever
we encounter X'220D0A' that is identified as trailer record for those group of records .
Input file2 Detail record Identifier : X'17' in Position 20
Requirement:Compare certain key fields from Header Record of Input file1 with that of
Any Detail record of File2 (that contains X'17' in Position 20)
and write all matching and unmatching entire group of records from Inputfile1
into o/p file 1 and o/p file 2 respectively
KEY Criteria for Comparison:
IF Pos 1 To Pos 4(Input file1 Header Record) = Pos 1 To Pos 4(Input file2 Detail Record)
AND Pos_22 To Pos_23(Input file1 Header Record) = Pos_22 To Pos_23(Input file2 Detail Record)
AND Pos_22 To Pos_23(Input file1 Header Record) = Pos_29 To Pos_30(Input file2 Detail Record)
THEN
Write only MATCHING group of records from Input file1 In output file 1
ELSE
Write only UNMATCHING group of records from Input file1 In output file 2
END-IF
Input file 1 sample:
Code:
Code: |
S2A BSTST.COM.ONLY.G1527.G0002V00 Columns 00001 00072
Command ===> Scroll ===> CSR
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 1537159 t 0 Ç 6lpl Ì 9 &d 0 0 &d ç 0 ã 0 1 0
FFFFFFF000A00F0301203063F999307303F3583F3F358332003133243F32343F3F3F0000
15371590003010080420A68A6373A08A1A9A04A0A0A04AA047A18A08A0A3A6A0A1A00000
------------------------------------------------------------------------------
000002 1537159 t 0 qËáÈ 4Á àr 4 3 0
FFFFFFF000A00F0100203000000974703F63493F3F3F2244444444444444444444444444
153715900030200C0726A00000583544A45A49A4A3A02C00000000000000000000000000
------------------------------------------------------------------------------
000003 1537159 t 0 /Â 0 0 0
FFFFFFF000A00F010020333006643F3F3F33003333322444444444444444444444444444
153715900030300B0D29A2A02121A0A0A0AA00AAAAA2C000000000000000000000000000
------------------------------------------------------------------------------
000004 1537159 t 0 6 &d 0 8 0 &d å ç 1
FFFFFFF000A00F0301213F3583000000003F3F3F358343333433333333213003F3333224
15371590003040050122A6A04A00000000A0A8A0A04A738318A000000A92A00A1AAAA2C0
------------------------------------------------------------------------------
------------------------------------------------------------------------------
000005 1537159 t 0 ë ì ß
FFFFFFF000A00F0500213231003000000000000353544444444444444444444444444444
15371590003050030D25A7A204A000000000001A8A900000000000000000000000000000
------------------------------------------------------------------------------
000006 1537159 t 0 A 100
FFFFFFF000A00F010021313C310301033FFF224444444444444444444444444444444444
15371590003060040725A3A1A00A000AA1002C0000000000000000000000000000000000
------------------------------------------------------------------------------
000007 1537159 t 0 0 5e 0 0 0
FFFFFFF000A00F0000213F3F83F3F3F22444444444444444444444444444444444444444
153715900030700F0624A0A55A0A0A02C000000000000000000000000000000000000000
------------------------------------------------------------------------------
000008 1537159 t 0 1 &Ì Ã &d
FFFFFFF000A00F010021303F223573263583122444444444444444444444444444444444
15371590003080050725A2A148A08A26A04A12C000000000000000000000000000000000
------------------------------------------------------------------------------
000009 1537159 t 0 Ã Ç Ì î â
FFFFFFF000A00F0200213630630731330313503133031340200444444444444444444444
15371590003090010825A6A68A08A1720A1760A1800A18202DA000000000000000000000
------------------------------------------------------------------------------
000010 1537159 u 0 Ç 6lpl ` ÑÏ 0 0 ÑÏ ç 0 2 0 ç 0
FFFFFFF000A00F0301203063F99930730313673F3F367332003133243F3F343F343F0000
15371590004010080420A68A6373A09A1A0A97A0A0A97AA047A19A08A0A2A1A0A8A00000 |
Input file 2 sample:
Code:
Code: |
S2A BSTST.TEST.ONLY.STRNG17.OUT Columns 00001 00072
Command ===> Scroll ===> CSR
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 1537199 Ö 0 Å - 6 0 0 0 0 0 ç 0 0 0 1 É
FFFFFFF000E00F03012030631003313363F3F3F3F3F3F32013103243F3F3F313F3000372
1537199003C010070420A67A0026A57A0A6A0A0A0A0A0A081A84A08A0A0A0A5A1A000612
------------------------------------------------------------------------------
000002 1537199 Ò 0 Å É
FFFFFFF000E00F0000213063003731322444444444444444444444444444444444444444
1537199003D0100F0427A67A0061A552C000000000000000000000000000000000000000
------------------------------------------------------------------------------
000003 1537199 Ò 0 k 2 8 0 0 0 0 0
FFFFFFF000E00F010021393F3F3F3F3F33F3F22444444444444444444444444444444444
1537199003D020050A25A2A2A8A0A0A0AA0A02C000000000000000000000000000000000
------------------------------------------------------------------------------
000004 1537199 Ò 0 m
FFFFFFF000E00F0000213930303022444444444444444444444444444444444444444444
1537199003D0300C0525A4A9A3A42C000000000000000000000000000000000000000000
------------------------------------------------------------------------------
------------------------------------------------------------------------------
000005 1537199 Ò 0 Ø 2 m d 2Á
FFFFFFF000E00F0100213033803F3933803F613122444444444444444444444444444444
1537199003D040080725A2A509A204A045A250A12C000000000000000000000000000000
------------------------------------------------------------------------------
000006 1537199 Ò 0 Ã Å ê è
FFFFFFF000E00F0100213630631331030303105031050200444444444444444444444444
1537199003D0500E0825A6A67A57A8490A0A8420A84402DA000000000000000000000000
------------------------------------------------------------------------------
000007 1537199 Ú 0 Å â - 6 0 0 0 0 1Äd ç 0 0 0 à 0
FFFFFFF000F00F03012030631003314363F3F3F3F3F3F6832013123243F3F3F34313F000
1537199003E010090420A67A0026A52A0A6A0A0A0A0A134A081A81A08A0A0A0A4A0A0000
------------------------------------------------------------------------------
000008 1537199 0 Å ã
FFFFFFF000F00F0000213063002431422444444444444444444444444444444444444444
1537199003F0100F0427A67A0016A512C000000000000000000000000000000000000000 |
Output file 1: Similar to Input file 1 But MATCHING all group of records from file 1 from header till trailer
Output file 2:Similar to Input file 1 But UNMATCHING all group of records from file 2 from header till trailer |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Why could you not start a new topic as it is a new question? Now a moderator has to clean up the mess. |
|
Back to top |
|
|
|