|
View previous topic :: View next topic
|
| Author |
Message |
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
Hi
I have a file which has the record in this order in FILE A
Incident number(10) Ind1(1) Ind2(1)
the possible values of Ind 1 and Ind 2 are P,G and A,B respectively
eg-
| Code: |
0000000091 P A
0000000091 G A
0000000072 P B
0000000051 G B |
I have another file, FILE B that has the Incident number field at 20 pos
My requirement is that I want to check FILE A for the incident number and possible combination 'P A' ,'G A','P B' and 'G B'.
I need omit sort cards in such a way so that- for eg
it checks for 'P A' and all incident no.
it checks for 'P B' and all incident no.
it checks for 'G A' and all incident no.
it checks for 'G B' and all incident no.
so i need 4 omit sort cards for all this,
for the incident numbers alone i had this sort card
| Code: |
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
HEADER1=(' SORT FIELDS=COPY ',/,
' OMIT COND=(1,1,BI,NE,1,1,BI,OR,'),
BUILD=(C' 20,10,CH,EQ,C''',1,10,C''',OR,',80:X),
TRAILER1=(' 1,1,BI,NE,1,1,BI)')
/* |
but i need the check for indicators also .Please help
Code'd |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please note that your post has been Code'd to preserve the spacing.
Can you show sample data, RECFM and LRECL, for both input files, and expected output from that, with matches, not matches, whatever. I think you are better looking at JOINKEYS, but can't be certain until we see what you want. |
|
| Back to top |
|
 |
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
The requirement is as follows:
There are 3 files
FILE A( FB nad LRECL 80)
FILE B( FB nad LRECL 200)
FILE C( FB nad LRECL 200)
File A contents are -
0000000091 P A
0000000091 G A
0000000072 P B
0000000051 G B
these are the meanings of indicators-
A and B indicate whether record need to be omitted from FILE B or FILE C
P-(type 1 incident),G(Type 2 incident) so P and G are types of incidents
if an incident no. is given with a P in file 1 , then the incident number is at pos 20 in FILEB or FILEC
if an incident no. is given with a G in file 1 , then the incident number is at pos 40 in FILEB or FILE C
So, based on these indicators i need omit sort condition to delete records from the 2 files FILE B and FILE C
Thanks in advance for your help |
|
| Back to top |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1216 Location: Dublin, Ireland
|
|
|
|
| Quote: |
| A and B indicate whether record need to be omitted from FILE B or FILE C |
Are the A records only in FileB and B records only in FileC or can they be in both? You need to be precise in giving your requirements.
Garry. |
|
| Back to top |
|
 |
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
A and B simply indicate whether records for a particular incident number needs to be deleted from FILE B or FILE C
both FILE B and FILE C have exactly same records initially. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You need to post both of the input files sample data and the output you want from that sample data. Make the samples comprehensive.
USE the Code tag for readability. Use the Preview to see how your post will apear to the forum.
Completely / clearly re-post your "rules". |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
mfchnuser,
What is the final output? Records from both FILEB and FILEC after the elimination into a single file? or do they need to be split accordingly ?
Run the following job and show us the complete sysout which helps us to determine the level of DFSORT your system has
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABC
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
//* |
|
|
| Back to top |
|
 |
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
ran the job you gave earlier
the sysout is as follows:
| Code: |
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 55BA6, MODEL 2817 708
SYSIN :
SORT FIELDS=COPY
WER276B SYSDIAG= 7613154, 12987187, 12987187, 8178825
WER164B 6,896K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 440K BYTES USED
WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER073I SORTIN : DSNAME=Z1225DJ.F0091CVT.JOB00968.D0000101.?
WER110I SORTOUT : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER074I SORTOUT : DSNAME=Z1225DJ.F0091CVT.JOB00968.D0000104.?
WER410B 5,868K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 324K BYTES USED
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B BSAM WAS USED FOR SORTIN
WER416B BSAM WAS USED FOR SORTOUT
WER054I RCD IN 1, OUT 1
WER169I RELEASE 1.4 BATCH 0520 TPF LEVEL 0.1
WER052I END SYNCSORT - F0091CVT,STEP0100,,DIAG=AC00,6242,8084,00CC,E47A,48CB,8688,8460 |
The requirement is as follows, to make it simpler i have used id that resembles to file name:
There are 3 files
FILE A( FB nad LRECL 80)
FILE B( FB nad LRECL 200)
FILE C( FB nad LRECL 200)
FILE A CONTENTS
| Code: |
0000000091 P B
0000000095 G B
0000000072 P C
0000000051 G C |
these are the meanings of indicators-
A and B indicate whether record need to be omitted from FILE B or FILE C
P-(type 1 incident),G(Type 2 incident) so P and G are types of incidents
if an incident no. is given with a P in file 1 , then the incident number is at pos 20 in FILEB or FILEC
if an incident no. is given with a G in file 1 , then the incident number is at pos 40 in FILEB or FILE C
So, based on these indicators i need omit sort condition to delete records from the 2 files FILE B and FILE C
Now example:
consider the contents are as follows:
FILE B CONTENTS
| Code: |
----+----1----+----2----+----3----+----4----+----5
123456789123456789AA00000000A1AAAAAAAAA0000000095
123456789123456789AA0000000021AAAAAAAAA0000000051
123456789123456789AA0000000091AAAAAAAAA0000000004
123456789123456789AA0000000072AAAAAAAAA0000000001 |
FILE C CONTENTS
| Code: |
----+----1----+----2----+----3----+----4----+----5
123456789123456789AA00000000A1AAAAAAAAA0000000095
123456789123456789AA0000000021AAAAAAAAA0000000051
123456789123456789AA0000000091AAAAAAAAA0000000004
123456789123456789AA0000000072AAAAAAAAA0000000001 |
now since file A has the following contents
FILE A CONTENTS
| Code: |
----+----1----+----2----+----3----+----4----+----5
0000000091 P B
0000000095 G B
0000000072 P C
0000000051 G C |
in the first record for the incident no. '0000000091' the indicator at 12 pos is P and at 14 pos is B
means that record needs to be deleted from file B and the incident no. will be at pos 20 in FILE B(indicated by 'P' in FILE A)
same way for 2nd record ithe incident no. '0000000095' the indicator at 12 pos is G and at 14 pos is B
means that record needs to be deleted from file B and the incident no. will be at pos 40 in FILE B(indicated by 'G' in FILE A)
same way for 3rd record ithe incident no. '0000000072' the indicator at 12 pos is P and at 14 pos is C
means that record needs to be deleted from file C and the incident no. will be at pos 20 in FILE C(indicated by 'P' in FILE A)
same way for 4th record ithe incident no. '0000000051' the indicator at 12 pos is G and at 14 pos is c
means that record needs to be deleted from file C and the incident no. will be at pos 40 in FILE C(indicated by 'G' in FILE A) |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
WER messages mean you have SynsSort, so posted in the wrong forum. SyncSort questions go in JCL.
Kolusu is a DFSORT developer. SyncSort is a competitor product, and you have now wasted Kolusu's time.
Please ensure you don't post in the wrong forum again. |
|
| Back to top |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1216 Location: Dublin, Ireland
|
|
|
|
Your output shows you are using SYNCSORT, not DFSORT. You have posted in the wrong forum - you should be in the JCL forum which is for both JCL and SYNCSORT.
Also, you have now changed from using A and B indicators to B and C indicators and these now appear to indicate from which of the files the records are to be removed. I asked for clarification on this yesterday but your response to that request did not clarify.
Garry. |
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I think as though you are over complicating this with Files B and C and the 'delete from' approach.
Try to redefine your requirements with just two input files 1 and 2 (since B and C are the same anyway).
You can then use a combination of Cond and Joinkeys (with unpaired 2) to select the ones you want from file 2 to go to output file 1 and the ones you want to go output file 2.
This positive logic is much easier for the human mind to process (at least my mind). |
|
| Back to top |
|
 |
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
Gary, sorry for posting this in DFSORT , i will repost in syncsort, i made indicators as B and C to make it sound easy , so that indicators match the file name
daveporcelan, these files B and C are not completely same, however many records are same. the records which i need to delete using sort card will exist in both files but that does not mean files are same. I just gave sample data as asked |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| mfchnuser wrote: |
Gary, sorry for posting this in DFSORT , i will repost in syncsort
|
Please don't do that. I've already moved the topic to the JCL forum, which is where SyncSort questions are dealt with. |
|
| Back to top |
|
 |
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
Thanks Bill for moving this to correct forum, It would be great if someoe can help me with this.
Thanks in advance |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Can you show the input and output files for the code that you were given, please? |
|
| Back to top |
|
 |
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
Input files:
FILE A
| Code: |
0000000091 P B
0000000095 G B
0000000072 P C
0000000051 G C |
FILE B
| Code: |
123456789123456789AA0000000051AAAAAAAAA0000000095
123456789123456789AA0000000021AAAAAAAAA0000000051
123456789123456789AA0000000091AAAAAAAAA0000000004
123456789123456789AA0000000072AAAAAAAAA0000000001
123456789123456789AA0000000015AAAAAAAAA0000000004
123456789123456789AA0000000023AAAAAAAAA0000000004
123456789123456789AA0000000045BBBBAAAAA0000000005
123456789123456789AA0000000032AAAAAAAAA0000000008 |
FILE C
| Code: |
123456789123456789AA0000000051AAAAAAAAA0000000095
123456789123456789AA0000000021AAAAAAAAA0000000051
123456789123456789AA0000000091AAAAAAAAA0000000004
123456789123456789AA0000000072AAAAAAAAA0000000001
123456789123456789AA0000000015AAAAAAAAA0000000004
123456789123456789AA0000000023AAAAAAAAA0000000004
123456789123456789AA0000000045BBBBAAAAA0000000005
123456789123456789AA0000000032AAAAAAAAA0000000008
123456789123456789AA0000000032AAAAAAAAA0000000045
123456789123456789AA0000000032AAAAAAAAA0000000176
123456789123456789AA0000000032AAAAAAAAA0000000668
123456789123456789AA0000000032AAAAAAAAA0000000678
123456789123456789AA0000000032AAAAAAAAA0000000488 |
after sort card execution, as per conditions given in FILE A
, the output in FILEB and FILE C are expected as
FILE B
| Code: |
123456789123456789AA0000000021AAAAAAAAA0000000051
123456789123456789AA0000000072AAAAAAAAA0000000001
123456789123456789AA0000000015AAAAAAAAA0000000004
123456789123456789AA0000000023AAAAAAAAA0000000004
123456789123456789AA0000000045BBBBAAAAA0000000005
123456789123456789AA0000000032AAAAAAAAA0000000008 |
FILE C
| Code: |
123456789123456789AA0000000051AAAAAAAAA0000000095
123456789123456789AA0000000091AAAAAAAAA0000000004
123456789123456789AA0000000015AAAAAAAAA0000000004
123456789123456789AA0000000023AAAAAAAAA0000000004
123456789123456789AA0000000045BBBBAAAAA0000000005
123456789123456789AA0000000032AAAAAAAAA0000000008
123456789123456789AA0000000032AAAAAAAAA0000000045
123456789123456789AA0000000032AAAAAAAAA0000000176
123456789123456789AA0000000032AAAAAAAAA0000000668
123456789123456789AA0000000032AAAAAAAAA0000000678
123456789123456789AA0000000032AAAAAAAAA0000000488 |
|
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
How many records are in each of these files?
The reason I ask is that an alternate approach (Rexx maybe) may be in order.
From my observation, a multiple pass Syncsort solution would be required.
You would need at least one step to Joinkeys on A and B and and another to Joinkeys A and C. There may even be two for each because the key in B and C varies based on the P/G value in A.
Not an easy one is it? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Code: |
OMIT COND=((12,1,CH,EQ,C'P',
AND,(20,10,CH,EQ,C'your number'),
OR,
(12,1,CH,EQ,C'G',
AND,(40,10,CH,EQ,C'your number'))) |
I have not run the above, but it should be close.
Something like that. Then you'll need to generate one of those (like your existing example) for each of the files.
You realise you will not be deleting records from the actual B and C files, but creating copies without those records on? |
|
| Back to top |
|
 |
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
Hi daveporcelan
The number of records vary from day to day load..it might go upto 50 k.
Rexx cant be used as this step has to be added as part of existing JCL.
Bill, since this will be a dynamic sort card since the FILE A contents will change daily. I was looking for what can be given using build statement |
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
| Quote: |
Rexx cant be used as this step has to be added as part of existing JCL.
|
A 'Step' can be added to the existing JCL invoking a Rexx Exec to perform the processing.
That is how I would do this complex of a requirement. That is just me. 50k records would process in a short amount of time.
You would need several Sort steps to accomplish your goals. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I was providing an OMIT that I thought you could then generate...
However...
As you do not know the P/G, except on FILE A, I don't think ANY single OMIT is going to do what you want (as you show in your data, that an incident number could be in either place on FILE B or C).
I think you would need to pass each of the two files twice, with different OMITs.
It is either that or "program time", or try to work out what Kolusu had in mind :-), bearing in mind also that there are things like JNFnCNTL files which DFSORT has and your SyncSort may not. |
|
| Back to top |
|
 |
Anbarasan D
New User
Joined: 20 Apr 2010 Posts: 21 Location: USA
|
|
|
|
You can try this.
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0000000091 P B
0000000095 G B
0000000072 P C
0000000051 G C
//FILEB DD DSN=&&FILEP,
// DISP=(,PASS,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(10,5),RLSE)
//FILEC DD DSN=&&FILEG,
// DISP=(,PASS,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(10,5),RLSE)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=FILEB,INCLUDE=(12,1,CH,EQ,C'P'),
BUILD=(1,80)
OUTFIL FNAMES=FILEC,INCLUDE=(12,1,CH,EQ,C'G'),
BUILD=(1,80)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=&&FILEP,
// DISP=SHR
//SORTJNF2 DD *
123456789123456789AA00000000A1AAAAAAAAA0000000095
123456789123456789AA0000000021AAAAAAAAA0000000051
123456789123456789AA0000000091AAAAAAAAA0000000004
123456789123456789AA0000000072AAAAAAAAA0000000001
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(01,10,A),SORTED
JOINKEYS FILE=F2,FIELDS=(21,10,A),SORTED
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F2:1,80)
SORT FIELDS=COPY
/* |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Mmmm.... are you sure that that is going to satisfy the requirement?
How are you distinguishing between TS's FILEB and FILEC for your, er, one final output file? |
|
| Back to top |
|
 |
Anbarasan D
New User
Joined: 20 Apr 2010 Posts: 21 Location: USA
|
|
|
|
| Sorry, I coded only for one output file(FILEB). Need to have the third step to get the output for FILEC(similar like S2 step) |
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I think you also need the output from step S2 to be reprocessed a second time to ensure it doesn't match Type G with File B.
I see this is many sort steps before your done.
Or one small Rexx program.
I think we have lost the TS however. Maybe wait to see if they are still with us. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|