MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Copy Specific fields from 2 files and create output

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Vinay Kumar M
Beginner


Joined: 02 Jun 2015
Posts: 12
Topics: 6

PostPosted: Tue Sep 15, 2015 4:46 am    Post subject: Copy Specific fields from 2 files and create output Reply with quote

Hello,

I have two DS's with below Data.

EXPL.DATA1

Code:

Command ===>                     
=COLS> ----+----1----+----2----+--
****** ***************************
000001 |NONE                     |
000002 |NONE                     |
000003 |NONE                     |
000004 |NONE                     |


EXPL.DATA2

Code:


=COLS> ----+----1----+----2----+----3----+
****** ***************************** Top o
000001   ACADESY                      MUST
000002   ACAEVAL                      MUST
000003   ACAZAMA                     MUST
000004   ACDELAN                      MUST





I want output DS to be Merged similar to Below Output

EXPL.DATA2

Code:

Command ===>                             
=COLS> ----+----1----+----2----+----3----+
****** ***************************** Top o
000001   ACADESY     NONE        MUST
000002   ACAEVAL     NONE        MUST
000003   ACAZAMA    NONE        MUST
000004   ACDELAN     NONE        MUST


RECFM=FB, LRECL=140 for both input and output DS's.

In preview i could see that 3rd row of EXPL.DATA2 is shifted 1 position left(Please ignore this, All are aligned in same line).
Please ignore this

Please Provide me JCL to place Data in Specific colums of Input DS into
Specific column of Output DS.
Back to top
View user's profile Send private message
Vinay Kumar M
Beginner


Joined: 02 Jun 2015
Posts: 12
Topics: 6

PostPosted: Tue Sep 15, 2015 4:50 am    Post subject: Reply with quote

I Forgot to Mention.

Content of EXPL.DATA1 is not Everytime Same(Like NONE,UNAVAILABLE etc.)
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Tue Sep 15, 2015 5:18 am    Post subject: Reply with quote

You need JOINKEYS. In the JNFnCNTL files, append a sequence number. The sequence number will be the key. On the REFORMAT statement select the fields from the two files in the order that you want.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Tue Sep 15, 2015 11:37 am    Post subject: Reply with quote

Vinay Kumar M,

Use the following DFSORT JCL which will give you the desired results
Code:

//STEP0100 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//INA      DD DISP=SHR,DSN=EXPL.DATA2
//INB      DD DISP=SHR,DSN=EXPL.DATA1
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                   
  OPTION COPY                                     
  JOINKEYS F1=INA,FIELDS=(141,8,A),SORTED,NOSEQCK 
  JOINKEYS F2=INB,FIELDS=(141,8,A),SORTED,NOSEQCK 
  REFORMAT FIELDS=(F1:1,14,F2:2,15,F1:20,111)     
//*                                               
//JNF1CNTL DD *                                   
  INREC OVERLAY=(141:SEQNUM,8,ZD)                 
//*                                               
//JNF2CNTL DD *                                   
  INREC OVERLAY=(141:SEQNUM,8,ZD)                 
//*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Vinay Kumar M
Beginner


Joined: 02 Jun 2015
Posts: 12
Topics: 6

PostPosted: Wed Sep 16, 2015 8:37 am    Post subject: Reply with quote

Thanks a Lot. Its Working Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group