IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To find the last 2 chars in each line using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sridevi_l01

New User


Joined: 10 Jun 2005
Posts: 2

PostPosted: Fri Jun 10, 2005 4:01 pm
Reply with quote

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
View user's profile Send private message
Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Fri Jun 10, 2005 4:21 pm
Reply with quote

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
View user's profile Send private message
sridevi_l01

New User


Joined: 10 Jun 2005
Posts: 2

PostPosted: Fri Jun 10, 2005 6:27 pm
Reply with quote

I want to extract the last 2 chars present in each line of the file.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Fri Jun 10, 2005 7:06 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jun 10, 2005 9:42 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue May 09, 2006 5:01 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top