I am checking the column 1-4, if it matches with a certain value, the field from column 6-9 should increase by 1. I am able to do that but if the value doesnt matches, a new record should be inserted.
Suppose the string to be matched is VWXY, then the output should be something like this.
I am checking the column 1-4, if it matches with a certain value, the field from column 6-9 should increase by 1. I am able to do that but if the value doesnt matches, a new record should be inserted.
Suppose the string to be matched is VWXY, then the output should be something like this.
ABCD 0001
BCDE 0002
CDEF 0002
VWXY 0001
Can this be done using DFSORT?
How are you getting certain value? Are they coming from different file?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Majid,
Will you only be checking for one value each time you run the job? Can the value be hardcoded? Or does it come from another file or a parameter or what?
If the value is found in a record, you want to increment the amount in the record in which the value is found. Is that correct? Can the value be present in more than one record?
If the value is not found in any record, you want to add a new record with that value and a count of 1. Is that correct? Where do you want to add it - at the end? in sorted order? Or what?
The 'certain value' is actually the job name which I am getting from the JOBNAME parameter. So the first 4 column can be considered as the Job Names and will be unique i.e. one value would not be present in more than one record.
The idea is to be able to use the step in different jobs and maintain a record of sequence IDs for the reports generated in those jobs. Sequence ID is to be increased by 1 everytime the job runs.
Frank, your understanding is correct. The record can be added anywhere, row number does not matter for the new record.
The 'certain value' is actually the job name which I am getting from the JOBNAME parameter.
This may be a dumb question to ask but what is JOBNAME parameter? Are you talking about JCL or DFSort Parm?
See if below job works for you... Here I am providing JOB name through SYMNAME but you may/can replace with JOBNAME parameter if that works for you. I ran this job with 2 inputs for match and unmatch conditions. Both the outputs are provided.