|
|
| Author |
Message |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 73 Location: INDIA
|
|
|
|
Hi,
I have a requirement like I need to write out records from file B when there is match of fields in fileA.
The fields in FILE A start from 18 and length is 3 and RECFM=FB
The fields in FILE B start from 2 and length is 3 and RECFM=VB.for this VB file I didnt include RDW.If you inlcude it then it will be from 6 and length is 3.
So when we geta match then we need to include all the records from FILEB. So the output file should also be VB.FILEB may contain duplicate keys. But I need to include those duplicate records also from FILEB so I used withall.
Currently I am using the following JCL.
| Code: |
//IN1 DD DSN=file A
//IN2 DD DSN=file B
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(200,100),RLSE),
// DCB=(RECFM=VB,LRECL=4250,BLKSIZE=0)
//OUT DD DSN=output file
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(4197,3,CH) -
WITH(5,4187) WITHALL USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL OVERLAY=(4193:18,3),FNAMES=T1,FTOV
/*
//CTL2CNTL DD *
OUTFIL OVERLAY=(4193:06,3),FNAMES=T1
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(5,4187)
/*
|
But I am getting error. So please help in this case
| Code: |
| ICE126A 9 INCONSISTENT OUT IFTHEN 0 REFORMATTING FIELD FOUND |
Regards
Amar[/b] |
|
| Back to top |
|
 |
References
|
Posted: Thu May 15, 2008 5:38 pm Post subject: Re: Confused with FB & VB datasets |
 |
|
|
 |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 73 Location: INDIA
|
|
|
|
Sorry I forgot to post the record lengths.
FILEA-- FB,200
FILEB--VB,4191
OUT should be ---VB,4191 as I want to extract the records from FILEB |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 73 Location: INDIA
|
|
|
|
Now I have chnaged the card as follows. Then it gave me return code zero.
| Code: |
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(200,100),RLSE),
// DCB=(RECFM=VB,LRECL=4199,BLKSIZE=0)
//OUT DD DSN=NMXT.APOG120.EIPL.MATCH,DISP=OLD
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(4193,3,CH) -
WITH(1,4187) WITHALL USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL BUILD=(1:1,200,3992X,18,3),FNAMES=T1,FTOV
/*
//CTL2CNTL DD *
OUTFIL OVERLAY=(4193:06,3),FNAMES=T1
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(1,4187)
/* |
I hope that should be correct.
Please let me know if there are any discrepancies in the above code.
Regards
Amar |
|
| Back to top |
|
 |
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 1128 Location: At my desk
|
|
|
|
| I don't know, but don't you need to include the RDW in the OUTFIL FNAMES=OUT,BUILD=(5,4187) statement? |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 73 Location: INDIA
|
|
|
|
That is why I confused and so I posted this thread.But now I got return code as zero but it is including the records from both FILE A and FILE B.
I am still working on that. |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 73 Location: INDIA
|
|
|
|
If you are right, then I need to change the on fields also right??
So I changed the card as below now.
| Code: |
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(4197,3,CH) -
WITH(5,4187) WITHALL USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL BUILD=(1:1,200,3992X,18,3),FNAMES=T1,FTOV
/*
//CTL2CNTL DD *
OUTFIL OVERLAY=(4193:06,3),FNAMES=T1
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(5,4187)
/*
|
need to check....
Regards
Amar |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 73 Location: INDIA
|
|
|
|
But got the same error repeated again...  |
|
| Back to top |
|
 |
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 1128 Location: At my desk
|
|
|
|
You fixed the OUTFIL while I was off looking up the error......
I'm confused too, after the match (?) in the splice, how can you tell which record is from which original file? Don't you need add an identifier in the CTL1 & 2 and then test for in in CTL3? |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 73 Location: INDIA
|
|
|
|
| Let's wait and see what Frank or Skolusu says.... |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4190 Location: San Jose, CA
|
|
|
|
Frank says:
Start over and show a good example of the records in each input file (relevant fields only) and what you expect for output. Give the RECFM and LRECL of each input file and the RECFM and LRECL you want for the output file. Give the starting position, length and format of each relevant field (for the VB file include the RDW when you give the starting positions). If input file1 can have duplicates within it, show that in your example. If input file2 can have duplicates within it, show that in your example. |
|
| Back to top |
|
 |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 73 Location: INDIA
|
|
|
|
Frank,
My requirement is to write out records from file B when there is match of particular fields against fileA.
File A---> RECFM=FB and LRECL=200 contains the following records
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----
M 6F3 32010F4208 DOM .. #
M 6F3 32010F4209 DOM .. #
M EO2 10101B10G1 DOM .. #
M KH1 10001EL01A DOM .. #
M 8H1 10001EL01A DOM .. #
|
File B-----> RECFM=VB and LRECL=4191 contains the following records
| Code: |
M208 1000110101B10G1 01910115 61
MEO2 11010009331281A 01970501 62
M209 11010009331301A 08970501 62
M10G 11010009331351A 01970501 62
|
So now when in File A position (18,3,CH) and File B position (6,3,CH) matches then I need to write the FILEB record to output file.One more thing is I need the output order of the records should be as same as they exist in FILEB.Here in file B is 6 is relative position actually in the file it exists in 2nd position.
regards
Amar |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4190 Location: San Jose, CA
|
|
|
|
You're getting closer but what about this:
| Quote: |
| If input file1 can have duplicates within it, show that in your example. If input file2 can have duplicates within it, show that in your example. |
You said previously that fileB can have duplicate keys but your example seems to have duplicates in fileA but not in fileB. Which file or files can really have duplicates?
| Quote: |
| what you expect for output |
You didn't show what you expect for output.
I don't have time for guessing games so please give me all of the information I asked for. Show an example with duplicates in one or both input files as appropriate and show the expected output. |
|
| Back to top |
|
 |
|
|
|