IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

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: 2432
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: 2432
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: 2432
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 All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts Hex Value - vb file replace old date ... DFSORT/ICETOOL 14
No new posts NOT ABLE TO FIND DB2 ROWS DB2 2
No new posts Need to read duplicate rows from tabl... DB2 3
This topic is locked: you cannot edit posts or make replies. Parsing more than 1000 columns in a s... SYNCSORT 10

Back to Top