IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

help to replace columns by rows


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vikas Maharnawar

New User


Joined: 19 Apr 2017
Posts: 6
Location: india

PostPosted: Tue Mar 06, 2018 3:27 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Mar 06, 2018 4:10 pm
Reply with quote

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
View user's profile Send private message
Vikas Maharnawar

New User


Joined: 19 Apr 2017
Posts: 6
Location: india

PostPosted: Tue Mar 06, 2018 4:30 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Mar 06, 2018 8:07 pm
Reply with quote

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
View user's profile Send private message
Vikas Maharnawar

New User


Joined: 19 Apr 2017
Posts: 6
Location: india

PostPosted: Wed Mar 07, 2018 7:55 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Mar 07, 2018 8:25 pm
Reply with quote

Please explain how you get that output from that input!
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Mar 07, 2018 9:36 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Mar 07, 2018 11:37 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Mar 08, 2018 1:52 am
Reply with quote

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
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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
Search our Forums:

Back to Top