|
View previous topic :: View next topic
|
| Author |
Message |
Vikas Maharnawar
New User
Joined: 19 Apr 2017 Posts: 6 Location: india
|
|
|
|
Hi,
I have two input files:
| Code: |
input1:-
123
456
789
input2:-
abc
|
i want to output in below format
| Code: |
Output:-
a23
b56
c89 |
I tried using sort join keys but i am struggling with output and i am getting output file like
| Code: |
output:-
123
456
789 |
please help me to getting correct output.
Thanks in advance!! |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Well, you cannot do it with JCL as JCL does not manipulate data - it does not even execute!
As you seem to be wanting a sort solution why did you not post in the appropriate sort forum?
Please show the control statements that you used.
Also, note that they are data sets not "files". |
|
| Back to top |
|
 |
Vikas Maharnawar
New User
Joined: 19 Apr 2017 Posts: 6 Location: india
|
|
|
|
Hi,
Below control statement i have used.
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILE=F1,FIELDS=(81,2,A),SORTED,NOSEQCK
JOINKEYS FILE=F2,FIELDS=(81,2,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,81,F2:1,81,?)
OUTREC IFOUTLEN=81,
IFTHEN=(WHEN=(77,1,CH,EQ,C'A'),OVERLAY(33:33,1)),
IFTHEN=(WHEN=(77,1,CH,EQ,C'C'),OVERLAY(35:35,1)),
IFTHEN=(WHEN=(77,1,CH,EQ,C'I'),OVERLAY(35:35,1)),
IFTHEN=(WHEN=(77,1,CH,EQ,C'P'),OVERLAY(35:35,1)),
IFTHEN=(WHEN=(77,1,CH,EQ,C'B'),OVERLAY(35:35,1))
//JNF1CNTL DD *
INREC IFTHEN=(WHEN=(77,1,CH,EQ,C'A'),OVERLAY=(81:SEQNUM,2,ZD)),
IFTHEN=(WHEN=(77,1,CH,EQ,C'C'),OVERLAY=(81:SEQNUM,2,ZD)),
IFTHEN=(WHEN=(77,1,CH,EQ,C'I'),OVERLAY=(81:SEQNUM,2,ZD)),
IFTHEN=(WHEN=(77,1,CH,EQ,C'P'),OVERLAY=(81:SEQNUM,2,ZD)),
IFTHEN=(WHEN=(77,1,CH,EQ,C'B'),OVERLAY=(81:SEQNUM,2,ZD))
/*
//JNF2CNTL DD *
INREC OVERLAY=(81:SEQNUM,2,ZD)
/* |
|
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Vikas,
You could use 'RESIZE' to convert your second input 'columns to rows'. But it is not so clear what you are trying to do. From your last post it looks like there is more than one record in your input-2 as opposed to what you have shown in your first example. Also what is the logic around this - 'A', 'C', 'I', 'P'....? Will you have other values in this field?
Can you show a more realistic sample input and expected output out of it. |
|
| Back to top |
|
 |
Vikas Maharnawar
New User
Joined: 19 Apr 2017 Posts: 6 Location: india
|
|
|
|
Hi,
Below are the input and expected output datasets i want to replace.
| Code: |
Input1:-
A,F
A,D
C,A,
A,R
R,R
Input2:-
AOC
PD
AOC
PF
AOR
IF
AOC
PF
AOA
PA
Output:-
AOA
PF
AOA
PD
AOC
IA
AOA
PR
AOR
PR
|
kindly help
Thanks in Advance!! |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Please explain how you get that output from that input! |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Vikas,
Will the record count in Input2 always be TWICE the number of records in Input1? If not, include such an example and explain how you want to handle that. Will Input-2 always have 3 and 2 byte fields in alternating sequence as shown in your example, or can those have random lengths? I would suggest you re-read this thread and answer the questions posted (including the ones you ignored).
Nic,
To me it looks like the OP wants to replace the last character in Input2 with a RESIZEd version of Input1 (one character each in each record). But I will let him confirm. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| No. It looks like you consider the whole of data set 1 (ds1) as one long string and that there should be a 1-to-1 relationship with data set 2 (ds2). The first character in ds1 replaces the last character of the first record in ds2, the second character (ignoring the commas) in ds1 replaces the last character of the second record in ds2, etc, etc. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Nic Clouston wrote: |
| It looks like you consider the whole of data set 1 (ds1) as one long string |
Not exactly a long string but yes, if we have the Input1 converted like this:
| Code: |
A
F
A
D
C
A
A
R
R
R |
then each character from this, replaces the last character in each record in the other data set. Again this is not a proposed sort solution step, but trying to break up the requirement logically. Still questions unanswered, so hopefully the OP can come back and post some useful info. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|