View previous topic :: View next topic
|
Author |
Message |
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
hi,
i have two input files.
file1:(LRECL=5)
FILE2:(LRECL=5)
I Need to compare two files and add comm at the end of each record except for last record. is there anyway we can add comma at the end of each record using jcl??
so my output should be
Using joinkeys we can copy matching records into output file.but am not sure about adding comma at the end of each record.
regds,
useit |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
i know we can add comma using below command.
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(6:C',')
but my problem is how can we identify last record and not to include comma for the last record?? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the issue has been discussed quite a few times
hy not search the forum Yourself ? |
|
Back to top |
|
|
Dsingh29
Active User
Joined: 16 Dec 2008 Posts: 132 Location: IBM
|
|
Back to top |
|
|
ezio vin
New User
Joined: 16 Aug 2012 Posts: 44 Location: india
|
|
|
|
if you are going to use the above specified inrec statement you will not get the exected result.
you will get the result like follows
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Useit,
Please don't try to gain attention for your topics by putting the subject in "all caps".
You mention that you are already using JOINKEYS. Can you show what you have, describe the task fully, and tell us the LRECL/RECFM of inputs and output. Sample input, sample output.
DATASORT is not going to help you unless your data is already in order on one particular byte, as otherwise the data will be rearranged as a SORT is required for DATASORT. |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
input file layput.
01.inrec
05 repgrp pic X(7)
Output file
01.outrec
05 repgrp pic X(7)
input file1:
Code: |
'Z4 '
'Z7 '
'Z8 '
'Z9 '
'Z777 '
'Z8888' |
input file2
Code: |
'Z4 '
'Z7 '
'Z4444' |
i need to capture only non matching records from the first file.
Code: |
//SORTJNF1 DD DSN=infile1,DISP=OLD
//SORTJNF2 DD DSN=infile2,DISP=OLD
//NOMATCH DD DSN=outfile,DISP=OLD
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(2,5,A)
JOINKEYS FILE=F2,FIELDS=(2,5,A)
REFORMAT FIELDS=(F1:1,7,F2:1,7)
JOIN UNPAIRED,F1,ONLY
SORT FIELDS=(2,5,CH,A)
//SRTMSGE DD SYSOUT=*
//*
|
so i have got output as
Code: |
'Z8 '
'Z9 '
'Z777 '
'Z8888' |
but i need to add comma at the end of eeach record of the output file.except the last record. so my output should be
Code: |
'Z8 ',
'Z9 ',
'Z777 ',
'Z8888' |
|
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Useit,
This is what you could do
Do a join of records in Step 1 and get the matched records
Use Symnames have a symbol and assign the value of total matched record count in Step1
In Step 2 use Inrec overlay with sequence number & replace the first space with comma and check for the symbol to check last record and dont do any action for it |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Useit,
The format of your sample is different from what you showed originally. Please be accurate first time up, otherwise we waste time looking at the wrong thing. OVERLAY will get the trailing comma on.
You are SORTing after the JOINKEYS. Because of the JOINKEYS your data is already in that order (JOINKEYS does SORTs by default). So you can make that
Are you expecting a large volume for your output? If not, it might be just as easy to do the DATASORT in a separate step, you are about to SORT on (1,1,CH,A). |
|
Back to top |
|
|
|