Getting last word



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Getting last word

Postby samb01 » Thu Jun 10, 2021 12:51 pm

Hello,
i vould like to get the last word of a record with dfsort.
I can't do it with the column number because it changes.
I have this jcl but it works only when the last agument is in column 32 :


 
//*********************************************************************
//ICE01   EXEC PGM=ICETOOL                                              
//INDD    DD DISP=SHR,DSN=FIC.DATASET                        
//TOOLIN  DD *                                                          
  COUNT FROM(INDD) EMPTY USING(HDTL) RC4                                
/*                                                                      
//HDTLCNTL DD *                                                        
  OMIT COND=(32,8,CH,EQ,C'LASTWORD')                                      
/*                                                                      
//TOOLMSG DD SYSOUT=*                                                  
//DFSMSG  DD SYSOUT=*                                                  
 


The last word could be in other column than 32 because of the size of the word just before that could have different lenght
I could use rexx to do that, but i prefer using dfsort.
Thank's for your help.
samb01
 
Posts: 411
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Getting last word

Postby enrico-sorichetti » Thu Jun 10, 2021 2:22 pm

read the dfsort manuals about SS - substring search

quite a few examples here and googling
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2963
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 159 times

Re: Getting last word

Postby samb01 » Thu Jun 10, 2021 8:10 pm

Hello, ss is not the good solution for me because i would like ta have juste on step and check the return code.

With SS, i have to write an other step to check if the file is empty or not.
samb01
 
Posts: 411
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Getting last word

Postby enrico-sorichetti » Thu Jun 10, 2021 8:42 pm

why the need for two steps You are aleady using the OMIT construct

https://www.ibm.com/docs/en/zos/2.1.0?t ... clude-omit

SS is accepted both for INCLUDE and OMIT
quoting the manual example
  INCLUDE COND=(1,75,SS,EQ,C'INTRODUCTION')


so nothing prevents You from using
 OMIT COND=(start,length,SS,EQ,C'LASTWORD')
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2963
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 159 times

Re: Getting last word

Postby sergeyken » Sun Jun 13, 2021 2:12 am

Please, clarify: what did you mean by this -
i vould like to get the last word of a record with dfsort.

Based on your code, you are trying to do vice versa: to ignore (via OMIT) the last word, isn’t it?
Javas come and go, but JCL stays forever.
User avatar
sergeyken
 
Posts: 169
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 3 times
Been thanked: 17 times

Re: Getting last word

Postby samb01 » Mon Jun 14, 2021 7:49 pm

Hello, thank's enrico, finally i use this sysin even if it can't match the last wost of the record but it works.
But with this method, i dont havec to have the same word in the same record :

//S1 EXEC PGM=ICETOOL
//INDD DD DISP=SHR,DSN=MY.DATA.SET
//TOOLIN DD *
COUNT FROM(INDD) EMPTY USING(HDTL) RC4
/*
//HDTLCNTL DD *
OMIT COND=(1,80,SS,EQ,C' SICAP ')
/*


when the word is in the record teh RC is 4, when it isn't teh RC is 0.
samb01
 
Posts: 411
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post