View previous topic :: View next topic
|
Author |
Message |
hiravibk Warnings : 1 Active User
Joined: 14 Dec 2008 Posts: 107 Location: India
|
|
|
|
Hi All,
I need to build part of a dynamic query, i was able build part of it but i am not sure how to proceed further. Please help.
Thanks in advance.
Input:
Code: |
02092016AB PUERTO RICO JOHN
|
The location name can come up anywhere between 11 and 41 positions.
Output Required:
What i tried:
Code: |
//STEP010 EXEC PGM=ICETOOL
//IN DD *
02092016AB PUERTO RICO JOHN
/*
//TEMP1 DD DSN=&&TEMP1
//TEMP2 DD DSN=&&TEMP2
//TOOLIN DD *
SORT FROM(IN) TO(TEMP1) USING(CTL1)
SORT FROM(TEMP1) TO(TEMP2) USING(CTL2)
/*
//CTL1CNTL DD *
OPTION COPY
INREC BUILD=(11,30,JFY=(SHIFT=RIGHT))
/*
//CTL2CNTL DD *
OPTION COPY
INREC FINDREP=(INOUT=(X'4040',X'',X'00',X''))
/*
|
Output I am getting:
|
|
Back to top |
|
|
Musab Ahmed
New User
Joined: 10 Dec 2012 Posts: 37 Location: India
|
|
|
|
Hi,
Try using LEAD and TRAIL within JFY. I have written a piece of code with DFSORT and not ICETOOL.
SORT FIELDS=COPY
INREC BUILD=(11,30,JFY=(SHIFT=LEFT,LEAD=C'''',TRAIL=C'%'' AND'))
Hope this helps. |
|
Back to top |
|
|
hiravibk Warnings : 1 Active User
Joined: 14 Dec 2008 Posts: 107 Location: India
|
|
|
|
Musab Ahmed wrote: |
Hi,
Try using LEAD and TRAIL within JFY. I have written a piece of code with DFSORT and not ICETOOL.
SORT FIELDS=COPY
INREC BUILD=(11,30,JFY=(SHIFT=LEFT,LEAD=C'''',TRAIL=C'%'' AND'))
Hope this helps. |
Thank you Musab! it works fine. |
|
Back to top |
|
|
|