Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
help to replace columns by rows

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: help to replace columns by rows
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: 2092
Location: UK

PostPosted: Tue Mar 06, 2018 4:10 pm    Post subject:
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    Post subject: Reply to: help to replace columns by rows
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: 2407
Location: @my desk

PostPosted: Tue Mar 06, 2018 8:07 pm    Post subject: Reply to: help to replace columns by rows
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    Post subject: Reply to: help to replace columns by rows Read more: http:/
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: 2092
Location: UK

PostPosted: Wed Mar 07, 2018 8:25 pm    Post subject:
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: 2407
Location: @my desk

PostPosted: Wed Mar 07, 2018 9:36 pm    Post subject: Reply to: help to replace columns by rows
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: 2092
Location: UK

PostPosted: Wed Mar 07, 2018 11:37 pm    Post subject:
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: 2407
Location: @my desk

PostPosted: Thu Mar 08, 2018 1:52 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Replace comp-3 field value to comp-3 ... dharmaraok DFSORT/ICETOOL 5 Fri Sep 14, 2018 3:46 pm
No new posts Delete Multiple rows in chunks by usi... dharmaraok DB2 5 Tue Sep 11, 2018 8:44 pm
No new posts Remove selected duplicate rows from t... hnharish DFSORT/ICETOOL 3 Wed Sep 05, 2018 3:11 am
No new posts Concatenaing multiple rows to single ... Vignesh Sid DFSORT/ICETOOL 1 Tue Aug 14, 2018 8:59 am
No new posts USS: Find and replace string within a... vasanthz All Other Mainframe Topics 5 Thu Aug 02, 2018 4:01 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us