Concatenate records using MID



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Concatenate records using MID

Postby Prakash88 » Thu Oct 24, 2013 9:02 pm

Hi.
I tried using syncsort to achieve below result. My objective is to concatenate records.

//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
    76940 43-188     2009-07-28
    76940 43-1889   2009-07-28
    76940 43 18898 2009-07-28
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC FIELDS=(1,17,SQZ=(SHIFT=LEFT,MID=C'_'),18,11)
OUTREC BUILD=(1,28,SQZ=(SHIFT=LEFT,MID=C'#'))
/*

Expected output:
76940_43-188#2009-07-28
76940_43-1889#2009-07-28
76940_43 18898#2009-07-28


Output i am getting:
76940_43-188@#2009-07-28
76940_43-1889@#2009-07-28
76940_43_18898@#2009-07-28



But MID command places _ delimiter on all spaces. I dont want to get _ as part of value when using MID syntax. Please help me on this.
Prakash88
 
Posts: 8
Joined: Fri Jun 21, 2013 5:41 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Concatenate records using MID

 

Re: Concatenate records using MID

Postby dick scherrer » Thu Oct 24, 2013 9:33 pm

Hello,

Suggest you re-post correcting the errors in the data and make sure you use the Code tag for readability and to preserve alignment.

But MID command places _ delimiter on all spaces. I dont want to get _ as part of value when using MID syntax.
Because you told the code to do so . . .

There seems to be an inconsistency with the dash and underscore . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Concatenate records using MID

Postby Prakash88 » Fri Oct 25, 2013 10:22 am

Thanks Dick for the reply.
Third input - 76940 43 18898 2009-07-28
Second field has space as part of value. I dont want to place _ when a field has space as part of value.Just want to concatenate three fields with _ delimiter. Is there any way to achieve this ?.
Prakash88
 
Posts: 8
Joined: Fri Jun 21, 2013 5:41 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Concatenate records using MID

Postby dick scherrer » Mon Oct 28, 2013 12:39 am

Hello,

You need to post the current code. If the code specifies a "_", why would it not appear in the output?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Concatenate records using MID

Postby BillyBoyo » Mon Oct 28, 2013 12:59 am

If you intention is to get a #-delimited output, try specifying MID=C' ' (ie a blank) on the first SQZ. Your second SQZ will then get # between each field.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post