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

Help on Sub String (SS) in sort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Thu May 05, 2011 5:55 pm
Reply with quote

Hi,

This is my sort code i'm trying to execute

SORT FIELDS=(16,7,CH,A,49,9,CH,A)
INCLUDE COND=(49,9,SS,EQ,C'000000008,000000028,000000040,
000000041,000000042,000000043,000000045,000000046,
000000053,000000055,000000056,000000057,000000059,000000060')

The error i'm getting is in attached doc.

Err Msg:- WER251A INCLUDE/OMIT INVALID SELF DEF TERM
Pls help me in resolving this...

Thanks
-3nadh
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu May 05, 2011 6:04 pm
Reply with quote

Is is so difficult to paste a screen in Notepad and copy it here between
Code:
[code][/code]
tags? It would have occupied about 200 bytes, not 92.5K and what's more most people here are far to sensible to download .DOC viruses.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 05, 2011 6:35 pm
Reply with quote

Please reread Prino's post, and then read it again, and again, until you understand what he is saying and then follow his instructions.

Attachments have been deleted.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Thu May 05, 2011 7:05 pm
Reply with quote

Pls find the error msg below..
I checked the error code in preview mode, the asterisk (*) under C'000000008' is appearing under 'INCLUDE'. so i decided to share it in attachmate for better understanding.

Code:
SYNCSORT FOR Z/OS  1.4.0.0R
SYSIN :                                                             
  SORT FIELDS=(16,7,CH,A,49,9,CH,A)                                 
  INCLUDE COND=(49,9,SS,EQ,C'000000008,000000028,000000040,         
                             *                                       
  000000041,000000042,000000043,000000045,000000046,                 
  *                                                                 
  000000053,000000055,000000056,000000057,000000059,000000060')     
  *                                                                 
WER161B  ALTERNATE PARM USED                                         
WER251A  INCLUDE/OMIT INVALID SELF DEF TERM                         
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                     
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                     
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                       
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Thanks
-3nadh

Post has been edited to use the
Code:
[code] [/code]
tags
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 05, 2011 7:16 pm
Reply with quote

So what does the manual say about the error messages issued.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu May 05, 2011 7:17 pm
Reply with quote

It seems to me you made up your own syntax.

Additionaly, from the meager information you provided, the format of ss is not required.

So try this:
Code:

INCLUDE COND=(49,9,CH,EQ,C'000000008',OR,
              49,9,CH,EQ,C'000000028',OR,
              49,9,CH,EQ,C'000000040',OR,
               ..........
              49,9,CH,EQ,C'000000060')
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu May 05, 2011 8:11 pm
Reply with quote

I agree with Dave.

There are two forms of the SS condition, e.g:

  • Code:
    1,3,SS,EQ,C'ABC,DEF,GHI'


    In this form (character string length greater than field length), SS checks the field for each group of three characters. So first it checks the field for 'ABC', then 'BC,' and so on. The comma is not really a delimiter - it's just a way to separate the needed groups of 3 characters.

  • Code:
    1,80,SS,EQ,C'ABC,DEF,GHI'

    In this form (field length greater than character string length), SS checks for the complete string everywhere in the record. So first it checks 1-11 for 'ABC,DEF,GHI', then it checks 2-12 and so on. The comma is just a character - it's not a delimiter or group separator.

    This is the form you're using and explains why it didn't do what you thought it would. Other condition with the ORs, which Dave has shown, should do what you want.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Thu May 05, 2011 8:20 pm
Reply with quote

The Error Message is

WER251A INCLUDE/OMIT INVALID SELF DEF TERM

WER251A INCLUDE/OMIT INVALID yyyyyyyyyy

EXPLANATION: The invalid relational condition represented by
yyyyyyyyyy was found in the INCLUDE/OMIT/WHEN/BEGIN/END parameter
specification.

I was trying to replace the following sort card using Substring which i mentioned earlier.

Code:

  SORT FIELDS=(16,7,CH,A,49,9,CH,A)                                 
  INCLUDE COND=(49,9,CH,EQ,C'000000008',OR,49,9,CH,EQ,C'000000028',
   OR,49,9,CH,EQ,C'000000040',OR,49,9,CH,EQ,C'000000041',OR,         
   49,9,CH,EQ,C'000000042',OR,49,9,CH,EQ,C'000000043',OR,           
   49,9,CH,EQ,C'000000045',OR,49,9,CH,EQ,C'000000046',OR,           
   49,9,CH,EQ,C'000000053',OR,49,9,CH,EQ,C'000000055',OR,           
   49,9,CH,EQ,C'000000056',OR,49,9,CH,EQ,C'000000057',OR,           
   49,9,CH,EQ,C'000000057',OR,49,9,CH,EQ,C'000000059',OR,           
   49,9,CH,EQ,C'000000060')


Thanks
-3nadh
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu May 05, 2011 8:50 pm
Reply with quote

If you have those many different values for the positions 49,9 - you've got to use ORs as you show. I don’t think so that there is some other way round to make your sort-card look rather elegant .

bodatrinadh - It's been more than 4 years now that you had been a member of this very Forum, please use BBcode Tags when you post some code or error message/s.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri May 06, 2011 5:07 am
Reply with quote

Hi,

your syntax was incorrect, this should work if you want to use the SS parameter
Code:
SORT FIELDS=(16,7,CH,A,49,9,CH,A)                                     
             INCLUDE COND=(49,9,SS,EQ,C'000000008,000000028,000000040,C
                    000000041,000000042,000000043,000000045,000000046,C
                    000000053,000000055,000000056,000000057,000000059,C
                    000000060')                                       



Gerry
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri May 06, 2011 3:00 pm
Reply with quote

Hi Gerry,

I try this, on the LPAR with SYNCSORT FOR Z/OS 1.3.2.2R:
Code:
//STEP001  EXEC PGM=SORT         
//SORTIN DD *                     
1,SGL01      ,GBP     ,ACK       
1 ,SGL 01    ,GBPEUR  ,ACK1       
//SORTOUT DD SYSOUT=*             
//SYSIN DD *                     
  OPTION COPY                     
  INCLUDE COND=(1,2,SS,EQ,C'GB,C 
                AC')             
//SYSOUT DD SYSOUT=*             
//*                               
and get a U0016 with following messages in SYSOUT:
Code:
SYSIN :                                         
  OPTION COPY                                   
  INCLUDE COND=(1,2,SS,EQ,C'GB,C               
                            *                   
                AC')                           
                *                               
WER251A  INCLUDE/OMIT INVALID SELF DEF TERM     
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000   
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE   
Please assist.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri May 06, 2011 4:17 pm
Reply with quote

Syncsort manual wrote:
If the control statement does contain a literal string that would extend beyond column 71, place a continuation character in column 72 and begin the continuation of the literal string in column 16 of the next card image.
Anuj,

The sort card shown by bodatrinadh in his original post was perfectly fine except for the continuation which Gerry has corrected in his post above. The continuation character HAS to be at pos-72 and NOT as shown in your example.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri May 06, 2011 4:35 pm
Reply with quote

There is something to learn, for me, today. However, something I'm missing here - below are the two rcords in input and I need all the records from input to output which have GB or AC appearing somewehre in the entire record, so basically both the records should appear in output:
Quote:
1,SGL01 ,GBP ,ACK
1 ,SGL 01 ,GBPEUR ,ACK1
- tried this, got RC=0 but no output:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//STEP001  EXEC PGM=SORT                                               
//SORTIN DD *                                                           
1,SGL01      ,GBP     ,ACK                                             
1 ,SGL 01    ,GBPEUR  ,ACK1                                             
//SORTOUT DD SYSOUT=*                                                   
//SYSIN DD *                                                           
  OPTION COPY                                                           
  INCLUDE COND=(1,2,SS,EQ,C'GB,GB,AA,AB,CB,GK,MJ,FK,LK,KK,JJ,JL,DB,LB, C
                AC')                                                   
//SYSOUT DD SYSOUT=*                                                   
//*                                                                     
and

Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//STEP001  EXEC PGM=SORT                                               
//SORTIN DD *                                                           
1,SGL01      ,GBP     ,ACK                                             
1 ,SGL 01    ,GBPEUR  ,ACK1                                             
//SORTOUT DD SYSOUT=*                                                   
//SYSIN DD *                                                           
  OPTION COPY                                                           
  INCLUDE COND=(1,2,SS,EQ,C'GB,                                        C
                AC')                                                   
//SYSOUT DD SYSOUT=*                                                   
//*                                                                     
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri May 06, 2011 7:15 pm
Reply with quote

Hi Anuj,

You are searching ONLY in pos 1-2. Change it to 1,80,SS.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri May 06, 2011 7:16 pm
Reply with quote

Quote:
- tried this, got RC=0 but no output:

Anuj,
I don't have syncsort so pardon me if my suggestion is not relevant but it looks like you are searching for the "string" in the first 2 bytes and not the entire record. The card looks for search string in the first 2 byte and it doesn't find the string.

Should it not be like 1,80,SS...?

Thanks,
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri May 06, 2011 7:54 pm
Reply with quote

bad day? icon_cry.gif
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//STEP001  EXEC PGM=SORT                                               
//SORTIN DD *                                                           
1,SGL01      ,GBP     ,ACK                                             
1 ,SGL 01    ,GBPEUR  ,ACK1                                             
//SORTOUT DD SYSOUT=*                                                   
//SYSIN DD *                                                           
  OPTION COPY                                                           
  INCLUDE COND=(1,80,SS,EQ,C'GB,                                       C
                AC')                                                   
//SYSOUT DD SYSOUT=*                                                   
//*                                                                     


SYSOUT:
Code:
SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE=    80           
SORTOUT  : RECFM=FB   ; LRECL=    80; BLKSIZE=    80           
5,868K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
   0 BYTES RESERVE REQUESTED, 156K BYTES USED                 
INSERT          0, DELETE          2                           
SYNCSMF  CALLED BY SYNCSORT; RC=0000                           
SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                           
BSAM WAS USED FOR SORTIN                                       
BSAM WAS USED FOR SORTOUT                                     
RCD IN          2, OUT          0                             


Other one:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//STEP001  EXEC PGM=SORT                                               
//SORTIN DD *                                                           
1,SGL01      ,GBP     ,ACK                                             
1 ,SGL 01    ,GBPEUR  ,ACK1                                             
//SORTOUT DD SYSOUT=*                                                   
//SYSIN DD *                                                           
  OPTION COPY                                                           
  INCLUDE COND=(1,80,SS,EQ,C'GB,GB,AA,AB,CB,GK,MJ,FK,LK,KK,JJ,JL,DB,LB,C
                AC')                                                   
//SYSOUT DD SYSOUT=*                                                   
//*                                                                     

Code:
SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE=    80             
SORTOUT  : RECFM=FB   ; LRECL=    80; BLKSIZE=    80             
5,868K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,   
   0 BYTES RESERVE REQUESTED, 156K BYTES USED                     
INSERT          0, DELETE          2                             
SYNCSMF  CALLED BY SYNCSORT; RC=0000                             
SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                             
BSAM WAS USED FOR SORTIN                                         
BSAM WAS USED FOR SORTOUT                                         
RCD IN          2, OUT          0                                 
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri May 06, 2011 9:15 pm
Reply with quote

Arun Raj wrote:
Syncsort manual wrote:
If the control statement does contain a literal string that would extend beyond column 71, place a continuation character in column 72 and begin the continuation of the literal string in column 16 of the next card image.
Hi Anuj,

Not so bad for me icon_smile.gif

Your continuation starts at pos-17 instead of 16.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sat May 07, 2011 7:46 am
Reply with quote

Hi,

I think the SS parameter has been misinterpreted.

In this example
Code:
INCLUDE COND=(1,80,SS,EQ,C'GB,GB,AA,AB,CB,GK,MJ,FK,LK,KK,JJ,JL,DB,LB


The search is for
Code:
'GB,GB,AA,AB,CB,GK,MJ,FK,LK,KK,JJ,JL,DB,LB'

as the length of the field to be tested is greater than the constant to be searched.

In Anuj's example you need this
Code:
 OPTION COPY                             
 INCLUDE COND=(1,80,SS,EQ,C'GB',OR,       
               1,80,SS,EQ,C'AA',OR,       
               1,80,SS,EQ,C'AB',OR,       
               1,80,SS,EQ,C'AC')         


Gerry
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat May 07, 2011 9:18 am
Reply with quote

Gerry,

You're right. I missed that point here.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top