The records will continue like this and we don't really know how many such series of ACCOUNT, PRODUCT, ENTITY combination records exist in the file. The format, like i mentioned above is uniform though.
-> If we find the word PRODUCT, set a SEQNUM in some position in the file. Similarly for the word ENTITY set another SEQNUM in another position
-> the tricky part is, to fetch the value that is right beside the words PRODUCT, ENTITY and write them by the side of the account numbers as shown in the output file, for that particular PRODUCT,ENTITY group.
I tried executing the code you posted and got S013 abend code ( UNSUCCESSFUL SORT ) for the 2nd step. May be because i didnot mention the input file properly, based on which you
wrote the sort card, it would have failed. Noteably,
a) There is data below the PRODUCT, ENTITY tags and beside the account numbers. It is not space, like i mentioned before
b) a dotted line followed by timestamp appears after each of the so called 'group'
Hmm..i didnot imagine that this will be a hinderance, but this is how my input file looks like actually.....
if You knew from the beginning,
can You explain why in h**l You asked for something,
and after somebody has replied with a solution,
only then You come up with the final requirement
it just shows no respect for people spending their own time testing and providing solutions for Your needs
do You behave in the same way when dealing with Your manager???
i tried changing the fileformat to what was 'desired', but did i ever say that the code that was posted here willnot help? I guess you are under a wrong assumption that i treat my manager and others in a different way....... I have a lot of respect for people out here and even if some one lashes out at me because i didnot make something clear, im fine, because you guys are a great bunch of people and are helping us out time and again. So apologies for assuming something and confusing you.
if its possible for you to help me out, i'll be more than happy. if you are not able to also, it is fine because you tried your level best to help me out already.
But the problem i face is that there is lot of other data in the second input file from position 1,25. So, even though i considered all records with numeric data in position 1,6 and also those with the tag ACCOUNT in the above sort card and eliminated those that didnot meet these conditions, iam seeing some alphanumeric data in the output that has first 6 digits as numeric and the rest being alphabetic.
So, is there a way to check for consecutive alphabets ( any number of ) in a field using SYNCSORT? That will help me get rid of the unwanted data in the output. Upon overcoming this problem, i will be able to use the sort card you posted.
Just to make it clear..The consecutive alphabetic characters could start anywhere with in the field and end up anywhere ,They need not necessarily be towards the end or beginning of the field.
Excellent, it worked!! Thank you Dick and Arun for your help in accomplishing an important task. As always, i've reveived very timely help from you guys.
I'll ensure from now that the final file creation criteria is mentioned clearly right from the beginning of the topic.
Sure Arun, here we go....Initially when you posted the code, we picked VERSION from the top of the file to fetch the date value adjacent to it. Now, i tweaked the logic bit to fetch the date from some other place of the input file.
I guess we would have accomplished the task thru EZYTRIEVE with a bit of lesser effort and coding, but certainly, i prefer SYNCSORT and believe me, its a lot faster and just took about 0.8 mins to run all the 4 steps, as opposed to nearly 5-6 mins thru EZYTRIEVE. This is considerable difference because, i need to execute the same piece of code for nearly 360 input files.
Code:
//*************************************************************
//**** FORMAT THE INITIAL FILE TO REMOVE UNWANTED TAGS ****
//**** AS WE WE NEED ONLY ACCOUNT INFORMATION HERE ****
//*************************************************************
//*************************************************************
//**** INCASE ANY 'CUSTOMER' LEVEL DATA APPEARS IN THE ****
//**** FILE WHEN THE 'FIRST 6 DIGIT NUMERIC' INCLUSION ****
//**** DATA CHECK FAILS, THIS STEP WILL REMOVE ALL THE ****
//**** RECORDS HAVING 4 CONSECUTIVE ALPHABETS STARTING ****
//**** FROM 7TH POSITION THRU 23RD IN THE OUTPUT OF ****
//**** STEP1 ****
//*************************************************************
//*************************************************************
//**** FORMAT THE OUTPUT OF STEP2 BY ADDING SEQUENCE NUM ****
//**** TO RECOGNISABLE TAGS LIKE 'PRODUCT' etc TO ****
//**** SEGREGATE THE FILE TO 'PRODUCT' TAG FILE AND A FILE****
//**** WITH RECS NOT HAVING A 'PRODUCT' TAG ****
//*************************************************************
//STEP3 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//T1 DD DSN=&&T1,DISP=(NEW,PASS),
// SPACE=(CYL,(1500,1400),RLSE),BLKSIZE=0,
// VOL=(,,,90)
//T2 DD DSN=&&T2,DISP=(NEW,PASS),
// SPACE=(CYL,(1500,1400),RLSE),BLKSIZE=0,
// VOL=(,,,90)
//SORTIN DD DSN=&&OUTPUT FILE2,DISP=SHR
//SYSIN DD *
OMIT COND=(1,7,CH,EQ,C'ACCOUNT')
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,START=0)),
IFTHEN=(WHEN=(28,1,CH,EQ,C'P'),OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(28,1,CH,EQ,C' '),OVERLAY=(89:SEQNUM,8,ZD,
81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
SORT FIELDS=COPY
OUTFIL FNAMES=T1,INCLUDE=(28,1,CH,EQ,C' '),BUILD=(1,88)
OUTFIL FNAMES=T2,INCLUDE=(28,1,CH,EQ,C'P'),BUILD=(1,88)
/*
//*************************************************************
//**** JOIN THE SEQUENCE NUMS ADDED TO THE OUTPUT FILES IN****
//**** STEP3 AND GENERATE THE FINAL INFOPAC FILE WITH ****
//**** ACCOUNT,PRODUCT,ENTITY,CURRENT MAINTENANCE DATE, ****
//**** PREVIOUS MAINTENANCE DATE ****
//*************************************************************
//STEP4 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=&&OUTPUT FILE3,
// DISP=(NEW,CATLG,DELETE)
//SORTJNF1 DD DSN=&&T1,DISP=(OLD,PASS)
//SORTJNF2 DD DSN=&&T2,DISP=(OLD,PASS) \
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(81,8,A),SORTED
JOINKEYS FILE=F2,FIELDS=(81,8,A),SORTED
REFORMAT FIELDS=(F1:1,23,F2:38,3,F2:52,8,F1:62,8,F1:73,8)
INREC BUILD=(1,23,29:24,3,40:27,8,50:35,8,70:43,8,30X)
SORT FIELDS=(1,23,CH,A)
SUM FIELDS=NONE
OUTFIL REMOVECC,
HEADER1=('ACCOUNT',29:'PRODUCT',40:'ENTITY',
50:'CURR MAINT DATE',70:'PREV MAINT DATE')