Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To find the last 2 chars in each line using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: To find the last 2 chars in each line using SORT
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    Post subject: Re: To find the last 2 chars in each line using SORT
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Jun 10, 2005 9:42 pm    Post subject:
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 Moderator


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

PostPosted: Tue May 09, 2006 5:01 am    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us