compare substring in the same record



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

compare substring in the same record

Postby samb01 » Mon Jun 12, 2023 1:08 pm

Hello,

i'd like to compare two strings in the same record. If they are equals, i keep the record.
Thinking about using the key word join paired but it works if they are two files, but i have just one.

For example :


AAAAA BBBBB CCCCC BBBBB
AAAAA CCCCC DDDDD EEEEE
 


if the strings are the same in column 7 until column 11 and the column 19 to 23 ==> i keep the record

In my example, i keep the first record

Thank's for your help.
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: compare substring in the same record

Postby sergeyken » Mon Jun 12, 2023 4:35 pm

 INCLUDE COND=(field1,EQ,field2)
 . . . . . etc. . . . . .
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 424
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: compare substring in the same record

Postby samb01 » Mon Jun 12, 2023 5:38 pm

thank's. Didn't think it was so obvious.
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: compare substring in the same record

Postby samb01 » Mon Jun 12, 2023 5:51 pm

sergeyken wrote:
 INCLUDE COND=(field1,EQ,field2)
 . . . . . etc. . . . . .


Hello. Thank's but it didn't work because filed 2 must be a substring constant :

ICE805I 1 JOBNAME: SYSTEMSB , STEPNAME: SORT2
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5650-ZOS, Z/OS DFSORT V2R5 - 14:17 ON MON JU
SORT FIELDS=COPY
INCLUDE COND=(59,8,SS,EQ,69,8)
$
ICE114A E INVALID COMPARISON
ICE751I 0 C5-I79519 C6-NONE C7-I76950 C8-I76518 E7-I76950
ICE052I 3 END OF DFSORT
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: compare substring in the same record

Postby dneufarth » Mon Jun 12, 2023 7:19 pm

might have mentioned substring requirement from beginning

elaborate on substring - such as known starting position and lengths or all possible variations that exist... and, provide 5 examples!
dneufarth
 
Posts: 23
Joined: Thu Oct 15, 2009 2:50 am
Has thanked: 1 time
Been thanked: 2 times

Re: compare substring in the same record

Postby sergeyken » Mon Jun 12, 2023 10:03 pm

samb01 wrote:Hello. Thank's but it didn't work because filed 2 must be a substring constant :


ICE805I 1 JOBNAME: SYSTEMSB , STEPNAME: SORT2                                  
ICE802I 0 BLOCKSET     TECHNIQUE IN CONTROL                                    
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5650-ZOS, Z/OS DFSORT V2R5  - 14:17 ON MON JU
           SORT FIELDS=COPY                                                    
           INCLUDE COND=(59,8,SS,EQ,69,8)                                      
                                    $                                          
ICE114A E INVALID COMPARISON                                                    
ICE751I 0 C5-I79519 C6-NONE   C7-I76950 C8-I76518 E7-I76950                    
ICE052I 3 END OF DFSORT                                                        
 


What your term "substring" stands for?
Where and how can you see this "substring"?
In all your examples there is no one "constant, nor "substring constant"...

Use the Code button to clearly demonstrate ANY SAMPLES!!!

Try to find out by yourself: what the message "ICE114A E INVALID COMPARISON " does mean?
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 424
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: compare substring in the same record

Postby Robert Sample » Mon Jun 12, 2023 11:58 pm

From the manual:
ICE114A INVALID COMPARISON
Last Updated: 2021-10-28

Explanation
Critical. One of the following situations exists:
The COND operand of an INCLUDE or OMIT statement, or the INCLUDE or OMIT operand of an OUTFIL statement or JOINKEYS statement, or the TRLID operand of an OUTFIL statement, or the IFTHEN WHEN, BEGIN or END operand of an INREC, OUTREC, or OUTFIL statement, contained an invalid field-to-field, field-to-mask, or field-to-constant comparison, or used a field with NUM that was not FS, CSF, PD, or ZD, or used a field with UC, LC, MC, UN, LN or MN that was not BI.
FORMAT=SS was specified after COND in an INCLUDE or OMIT statement.


Also in the manual:
 INCLUDE FORMAT=SS,COND=(11,6000,EQ,C'OK',OR,5,3,EQ,C'J69,L92,J82')


This example illustrates how to include only records in which:
OK is found somewhere within bytes 11 through 6010
OR

Bytes 5 through 7 contain J69, L92 or J82.
I am not a SORT expert, but I think if you insist on putting COND=...,SS, then you will never get the code to work.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: compare substring in the same record

Postby samb01 » Tue Jun 13, 2023 12:00 pm

Hello, really sorry.
I anderstand now why it didn't work.
My dataset was in VB format. A beginner mistake :oops: :oops: :oops:
So now it works with that sysin by adibng for digits for each column i compare :


SORT FIELDS=COPY                  
INCLUDE COND=(60,8,CH,EQ,69,8,CH)
 
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: compare substring in the same record

Postby sergeyken » Tue Jun 13, 2023 7:11 pm

samb01 wrote:

SORT FIELDS=COPY                  
INCLUDE COND=(60,8,CH,EQ,69,8,CH)
 

Where is any substring???!!! :?
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 424
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: compare substring in the same record

Postby dneufarth » Tue Jun 13, 2023 10:07 pm

Where is any substring???!!! :?


You might say both fields specified are substrings of the entire input record! :lol:
dneufarth
 
Posts: 23
Joined: Thu Oct 15, 2009 2:50 am
Has thanked: 1 time
Been thanked: 2 times

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post