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 

how to add a string in outrec using syncsort

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


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Thu Oct 13, 2005 6:01 am    Post subject: how to add a string in outrec using syncsort Reply with quote

hi,

i have a input file as below

-------------------------------------
H bbbbbb xxxxxx yyyyyy
d zzzzzzz zzzzzz
d aaaaaaaaa aaaaa
.
.......
T 000044455

-------------------------------

here i want to add some part of the header record with each detailed record as below
---------------------------------
d xxxxxx zzzzzzz zzzzzz
d xxxxxx aaaaaaaaa aaaaa
.
.......
----------------------------------------



can you please help any one this...


thanks in advance for ypur help


js...
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Oct 13, 2005 6:04 am    Post subject: Reply with quote

js01,

This information is not sufficient. Please provide the following details.

1. LRECL & RECFM of your input file.
2. How many header-data-trailer sets do you have in your file ? (will there be multiple header-deta-trailers ???).

Thanks,
Phantom
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Oct 13, 2005 6:20 am    Post subject: Reply with quote

JS01,

Under the assumption that your input file is of LRECL=40 & RECFM=FB, I have coded the following sort card.

You may have to tailor the code to suit your needs.
Code:

//R010   EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//INPUT    DD  *                                             
H BBBBBB XXXXXX YYYYYY                                       
D ZZZZZZZ ZZZZZZ                                             
D AAAAAAAAA AAAAA                                             
T 000044455                                                   
/*                                                           
//CTL2CNTL DD  DSN=&&T1,DISP=(,PASS)                         
//OUTPUT   DD  SYSOUT=*                                       
//TOOLIN   DD  *                                             
  COPY FROM(INPUT)  TO(CTL2CNTL) USING(CTL1)                 
  COPY FROM(INPUT)  TO(OUTPUT)   USING(CTL2)                 
//CTL1CNTL DD  *                                             
  INCLUDE COND=(1,1,CH,EQ,C'H')                               
  OUTFIL OUTREC=(C'  OUTREC FIELDS=(1,1,',80:X,/,             
                 C'                 1X,',80:X,/,             
                 C'                 C''',10,6,C''',',80:X,/,   *  copy header portion *
                 C'                 1X,',80:X,/,             
                 C'                 3,37)',80:X)             
/*                                                           


Hope this helps,

Thanks,
Phantom


Last edited by Phantom on Thu Oct 13, 2005 6:31 am; edited 1 time in total
Back to top
View user's profile Send private message
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Thu Oct 13, 2005 6:21 am    Post subject: Reply with quote

Hi phantan,
thanks a lot for your quick responce

answers to your questiosn

1) 200 ( LRECL) & FB
2) only one header and trailer


regards
js
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Oct 13, 2005 6:34 am    Post subject: Reply with quote

JS01,

You have to change the last line of sort card
Quote:

3,37)',80:X)


To
Code:

C'                 3,197)',80:X)


Additionally you have to play around with the field positions in header record. Try and let me know if you face any problem.

Thanks,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Oct 13, 2005 10:08 am    Post subject: Reply with quote

Phantom,

It would be good idea to use STOPAFT instead of a INCLUDE COND in the first copy pass. if by any chance you have more than 1 record with 'h' in the first byte , your job will abend. since you are looking just for a single header record you can just use STOPAFT.

Also I see that you use c' ' to allign the dynamic sort control cards. you can use nx to create the spaces. Also you don't have to code 80:x on every line

your control cards can be changed to

Code:

 OPTION STOPAFT=1 
 OUTFIL OUTREC=(C'  OUTREC FIELDS=(1,1,',/,   
                17X,                         
                C'X,',/,                     
                17X,                         
                C'C',                         
                C'''',                       
                10,6,       $ copy header info
                C'''',                       
                C',',/,                       
                17X,                         
                C'X,',/,                     
                17X,                         
                C'3,37)',80:X)               


on the other hand I think using SYMBOLS is good idea. Using symbols will give lot of flexibility in terms putting the header any where on the output record.

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
H BBBBBB XXXXXX YYYYYY                                     
D ZZZZZZZ ZZZZZZ                                           
D AAAAAAAAA AAAAA                                         
T 000044455                                               
//SORTOUT  DD  DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN    DD  *                                           
  OPTION STOPAFT=1                                         
  SORT FIELDS=COPY                                         
  OUTREC FIELDS=(C'HEADER-INFO,C',                         
                 C'''',                                   
                 10,6,                                     
                 C'''',                                   
                 80:X)                                     
/*                                                         
//STEP0200 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SYMNAMES DD DSN=&&T1,DISP=OLD                           
//SORTIN   DD *                                           
H BBBBBB XXXXXX YYYYYY                                     
D ZZZZZZZ ZZZZZZ                                           
D AAAAAAAAA AAAAA                                         
T 000044455                                               
//SORTOUT  DD  SYSOUT=*                                   
//SYSIN    DD  *                                           
  SORT FIELDS=COPY                                         
  OUTREC FIELDS=(1,09,HEADER-INFO,16,25)                   
/*                   


The symbols will be substituted as follows

Code:

SYSIN :                                 
  SORT FIELDS=COPY                     
  OUTREC FIELDS=(1,09,HEADER-INFO,16,25)
DATA DICTIONARY SYMBOLS SUBSTITUTED :   
SORT FIELDS=COPY                       
OUTREC FIELDS=(1,09,C'XXXXXX',16,25)   


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


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Oct 14, 2005 12:18 am    Post subject: Reply with quote

Hi Kolusu,

Quote:

It would be good idea to use STOPAFT instead of a INCLUDE COND in the first copy pass.


This is really a nice suggestion. Though he says that he has only one header, we just have to be sure that the job does not abend even in extreme conditions. Thanks a lot.

Quote:

on the other hand I think using SYMBOLS is good idea


Hmm....I never tried using SYMBOLS. As you know, my previous shop had Syncsort v 3.7 which does not support most of the features. Got to try out different options ATLEAST NOW. Thanks for the idea.

Also, we need to know what version of sort js01 has.

JS01,

What version of sort do you have ??? Just code a dummy sort step (PGM=SORT) and go to the sysout and paste the first line sysout which contains the version (Note: Don't use PGM=SYNCTOOL).

Thanks,
Phantom
Back to top
View user's profile Send private message
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Wed Oct 19, 2005 3:12 am    Post subject: Reply with quote

Thanks a lot Kolusu and Phantom,

It is working perfect as i required.

regards
js
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