View previous topic :: View next topic
|
Author |
Message |
byte Currently Banned New User
Joined: 04 May 2006 Posts: 4
|
|
|
|
I have an INPUT file.The layout of input file is given below.Taking this as
Input need to create an Ouput file (Layout given below) based on the following condition.
Need to eliminate the $ sign from the input file, more than one Spacings which comes between the First and Second Names with single spacing and have to create the output file as given below .
Any idea how i can do this using SORT/Icetool (no cobol pls)
Code: |
Input File
-----------
Mark$$Spencer 1204505678AB546776 SWS
Peter$$$$Shildon 1204505678AB546776 SWS
Dirk$$$$$$M$$ Tyle 5678490022CC695486 MFT
|
Code: |
Output File
--------------
Mark Spencer 1204505678AB546776 SWS
Peter Shildon 1204505678AB546776 SWS
Dirk M Tyle 5678490022CC695486 MFT
|
Thanks in advance
Byte
I |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's new SQZ function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:
Use [URL] BBCode for External Links
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1:1,20,SQZ=(SHIFT=LEFT,PREBLANK=C'$',
MID=C' '))
/*
|
|
|
Back to top |
|
|
byte Currently Banned New User
Joined: 04 May 2006 Posts: 4
|
|
|
|
Thanks Frank for your wonderful and quick reply..
I went thru the link as well which you sent ;the illustartion for SQZ in that is very straight forward to understand..
Byte.. |
|
Back to top |
|
|
byte Currently Banned New User
Joined: 04 May 2006 Posts: 4
|
|
|
|
Frank,
In manual the usage given is
OPTION COPY
OUTREC FIELDS=(1,20,SQZ=(SHIFT=LEFT,MID=C',')) can I use this too?
Also pls let me know why you have used INREC OVERLAY?
INREC OVERLAY=(1:1,20,SQZ=(SHIFT=LEFT,PREBLANK=C'$',
MID=C' '))
Thanks in advance
Byte |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Also pls let me know why you have used INREC OVERLAY? |
I used INREC OVERLAY because you just wanted to change the first 20 bytes without changing the rest of the record. OVERLAY=(1:1,20,SQZ...) only affects the first 20 bytes without affecting anything else. That's what you asked for.
Quote: |
In manual the usage given is
OPTION COPY
OUTREC FIELDS=(1,20,SQZ=(SHIFT=LEFT,MID=C',')) can I use this too?
|
Huh? That's valid syntax but it has nothing to do with your requirement. It will shift left and put a comma wherever it finds a blank between the first nonblank and last nonblank. It will also only give you the first 20 bytes of the input records in your output records. For your example, that would give you the following output which is not what you asked for:
Code: |
Mark$$Spencer
Peter$$$$Shildon
Dirk$$$$$$M$$,Tyle
|
whereas the INREC statement I showed you would give you the following output which is what you asked for:
Code: |
Mark Spencer 1204505678AB546776 SWS
Peter Shildon 1204505678AB546776 SWS
Dirk M Tyle 5678490022CC695486 MFT
|
You have to use the right control statements to get what you want. |
|
Back to top |
|
|
byte Currently Banned New User
Joined: 04 May 2006 Posts: 4
|
|
|
|
Frank,
It was a mistake from my when sent
The actual syntax was
OPTION COPY
OUTREC FIELDS=(1,20,SQZ=(SHIFT=LEFT,PREBLANK=C'$',MID=C' '))
can I use this too?
Thanks
Byte |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I'm having a hard time figuring out what you want to do. I gave you the syntax needed to go from the input to the output you showed in your first post. Are you trying to get different output now?
Code: |
OPTION COPY
OUTREC FIELDS=(1,20,SQZ=(SHIFT=LEFT,PREBLANK=C'$',MID=C' '))
|
would give you the following 20-byte output records:
Code: |
Mark Spencer
Peter Shildon
Dirk M Tyle
|
If that's what you want for output instead of the output you said you wanted originally (with all of the fields), then you can use that syntax to get it. If you want the output you originally said you wanted, then you need to use the syntax I gave you. |
|
Back to top |
|
|
twissi
Active User
Joined: 01 Aug 2005 Posts: 105 Location: Somerset, NJ
|
|
|
|
Hi Byte,
Maybe you can try the following as an alternate:
//STEP011 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN= input file here
//SORTOUT DD DSN=output file here
// DISP=(NEW,CATLG,CATLG)
// SPACE=(CYL,(20,20),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,
OUTREC=(1,820,TRAN=ALTSEQ)
ALTSEQ CODE=(4A40)
/*
This should be the record length of your input file.
4A is the HEX Code for $ and 40 is that for SPACE
Hope this helps you!
Cheers, Twissi. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Twissi,
'$' is X'5B', not X'4A' and using TRAN=ALTSEQ like that will just replace each '$' with a blank. That will NOT give just one blank between the names as was requested. Your output would be:
Code: |
Mark Spencer 1204505678AB546776 SWS
Peter Shildon 1204505678AB546776 SWS
Dirk M Tyle 5678490022CC695486 MFT
|
Go back to the first post and you'll see that's not the output requested. The DFSORT job I showed does give the output requested which is:
Code: |
Mark Spencer 1204505678AB546776 SWS
Peter Shildon 1204505678AB546776 SWS
Dirk M Tyle 5678490022CC695486 MFT
|
|
|
Back to top |
|
|
twissi
Active User
Joined: 01 Aug 2005 Posts: 105 Location: Somerset, NJ
|
|
|
|
Frank,
I was just about to leave from office Y'day when I saw that request, may be I failed in understanding the problem because of the lack of time.
Thaks for pointing it out .
However, I still believe '$' is X'4A' :
Code: |
//***$? TO DELETE ALL TEMP FILES
665554544444444444ED4CCDCEC4CDD4ECDD4CCDCE444444444444444444444444444444
11CCCAB00000000000360453535013303547069352000000000000000000000000000000 |
X'5B' is '?'
Please correct me if I'm wrong, thanks.
Thanks, Twissi. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's what I see for the same line:
Code: |
//***?$ TO DELETE ALL TEMP FILES
665554544444444444ED4CCDCEC4CDD4ECDD4CCDCE444444444444444444...
11CCCAB00000000000360453535013303547069352000000000000000000...
|
My yellow card with the EBCDIC codes and Appendix D of "DFSORT Application Programming Guide" both show 4A as the cent sign and 5B as the dollar sign. I believe these are the standard EBCDIC codes. You're probably displaying these values as your local currency symbols by way of a different code page. Maybe somebody who knows more about such things can explain it more clearly. |
|
Back to top |
|
|
twissi
Active User
Joined: 01 Aug 2005 Posts: 105 Location: Somerset, NJ
|
|
|
|
Frank, thanks a ton for your thoughts.
Regards, Twissi. |
|
Back to top |
|
|
|