View previous topic :: View next topic
|
Author |
Message |
sridevi_l01
New User
Joined: 10 Jun 2005 Posts: 2
|
|
|
|
Hi,
I need to find the last 2 characters of each line in a file using SORT (not ICETOOL).
Eg
ab123;45;kjg; -> g;
12;ddd;45;88 -> 88
ytr;55;;; -> ;;
The position where the last 2 chars occurs in the file is not fixed.
Pls help me with a sort card to achieve the same.
Thanks. |
|
Back to top |
|
|
Alain Benveniste
New User
Joined: 14 Feb 2005 Posts: 88
|
|
|
|
What do you mean by find. Do you want to extract records if a condition is met, do you want only the 2 last characters of the records or what else.
Could you clarify your need
Alain |
|
Back to top |
|
|
sridevi_l01
New User
Joined: 10 Jun 2005 Posts: 2
|
|
|
|
I want to extract the last 2 chars present in each line of the file. |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
I can't understand your request about the use of DFSORT or ICETOOL.
But in each case... which is its record format and the LRECL? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
sridevi_l01,
I assume you're trying to extract the last 2 characters before the first blank in each line ... right? SORT products do not have any built-in functions for doing this kind of find and extract operation.
I'd suggest using programming logic (REXX, COBOL, an E15 exit, whatever you're comfortable with) to do this. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I assume you're trying to extract the last 2 characters before the first blank in each line ... right? SORT products do not have any built-in functions for doing this kind of find and extract operation. |
You can now do this with DFSORT using the new JFY function available with z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) as shown by the DFSORT job below. For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTFs, see:
Use [URL] BBCode for External Links
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTDIAG DD DUMMY
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
* Right-justify the characters in positions 1-13.
INREC FIELDS=(1,13,JFY=(SHIFT=RIGHT))
* Extract the characters from 12-13.
OUTREC FIELDS=(12,2)
/*
|
|
|
Back to top |
|
|
|