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 

DFSORT arrange record and append semicolon

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Himanshu
Beginner


Joined: 23 May 2016
Posts: 4
Topics: 2
Location: India

PostPosted: Tue Jun 21, 2016 11:43 pm    Post subject: DFSORT arrange record and append semicolon Reply with quote

Hi DFSort experts,

I have an input file as below:

Input:
Code:

AABZAS   S01  S02  S03  S04
AABZBS01 S03               
AABZCS03                     
AABZDS   S01  S02  S03  S04
AABZES01 S02  S03  S04  S05 S06

First 5 positions are client Key, then 'S' is for select in all the records, then there are 01, 02, 03, 04 as comm number. In some records comm number is not there (only 'S' is there, e.g in 1st record, in col 6 'S' is there but there is no comm number in col 7-8). My output should look as below:

Output
Code:

AABZA 01; 02; 03; 04
AABZB 01; 03               
AABZC 03                     
AABZD 01; 02; 03; 04

In output, first five position should be Client key, then a comm number followed by semicolon and then next comm number. Please help to achieve this in dfsort.

Thanks a lot.
_________________
Himanshu
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 22, 2016 10:48 am    Post subject: Reply with quote

Himanshu,

Use the DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
AABZAS   S01  S02  S03  S04                               
AABZBS01 S03                                             
AABZCS03                                                 
AABZDS   S01  S02  S03  S04                               
AABZES01 S02  S03  S04  S05 S06                           
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  OPTION COPY                                             
  INREC FINDREP=(STARTPOS=6,ENDPOS=31,INOUT=(C'S',C' ')) 
  OUTREC OVERLAY=(7:7,25,SQZ=(SHIFT=LEFT,MID=C'; '))     
//*

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


Joined: 23 May 2016
Posts: 4
Topics: 2
Location: India

PostPosted: Thu Jun 23, 2016 8:41 am    Post subject: Reply with quote

Thank you Kolusu.
_________________
Himanshu
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 -> Utilities 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