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
 

 

INCLUDE condition for checking low values or spaces
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rammohan paulrajan

New User


Joined: 28 Nov 2007
Posts: 11
Location: chennai

PostPosted: Fri Jul 19, 2013 3:02 am    Post subject: INCLUDE condition for checking low values or spaces
Reply with quote

Hi, I have a requirement like below

I have a file with address information and I would like to filter (include) only records which has address information. Address position is 1 to 40.

When I tried the below sort card, it didn't work out. Could you help me with any other way

//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,40,CH,NE,X'00',AND,1,40,CH,NE,X'40')
/*
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Jul 19, 2013 3:07 am    Post subject: Reply to: INCLUDE condition for checking low values or space
Reply with quote

You want to exclude all records with spaces or binary-zeros in the first 40 bytes?
Back to top
View user's profile Send private message
rammohan paulrajan

New User


Joined: 28 Nov 2007
Posts: 11
Location: chennai

PostPosted: Fri Jul 19, 2013 3:15 am    Post subject:
Reply with quote

Yes Woodger. Thats right
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jul 19, 2013 5:39 am    Post subject:
Reply with quote

Hello,

Can there be both x'00' and x'40' in the same 1st 40 bytes?

Or does the first 40 bytes need to be completely space or x'00' to be skipped?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Jul 19, 2013 11:44 am    Post subject: Reply to: INCLUDE condition for checking low values or space
Reply with quote

Other than the INCLUDE being more difficult tp read due tpo the negated condition, it should be working.

Which means what you have described is not the full story.

Please post the sysout from a step which did not work, show some sample input records and expected output and provide the RECFM/LRECL of the input, and output if different.

Pay close attention to Dick's question.

Consider re-writing the INCLUDE as OMIT:
Code:

  OMIT COND=(1,40,CH,EQ,X'00',
          OR,1,40,CH,EQ,C' ')


NB. TS had X'40', which in the test for a field longer than one byte compared the value "padded" with binary zeros, due to the use of a hexadecimal constant. Using C' ' for a space, a character constant, causes the comparison to be padded with space and works correctly.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jul 19, 2013 12:38 pm    Post subject:
Reply with quote

Hi Bill,

I tried the following :-
Code:

//STEP0001 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
                                                                       
    A                                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
 SORT FIELDS=COPY                                                     
  OMIT COND=(1,20,CH,EQ,X'00',                                         
          OR,1,20,CH,EQ,X'40')                                         
//STEP0002 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
                                                                       
    A                                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
 SORT FIELDS=COPY                                                     
  OMIT COND=(1,20,CH,EQ,X'0000000000000000000000000000000000000000',   
          OR,1,20,CH,EQ,X'4040404040404040404040404040404040404040')   


from STEP0001
Code:
//SORTIN   DD *                                                         
66EDDECD444CC45444444444444444444444444444444444444444444444444444444444
11269395000440C000000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
                                                                       
444444444444444444444444444444444444444444444444444444444444444444444444
000000000000000000000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
    A                                                                   
4444C4444444444444444444444444444444444444444444444444444444444444444444
000010000000000000000000000000000000000000000000000000000000000000000000



From STEP0002
Code:
//SORTIN   DD *                                                         
66EDDECD444CC45444444444444444444444444444444444444444444444444444444444
11269395000440C000000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
                                                                       
444444444444444444444444444444444444444444444444444444444444444444444444
000000000000000000000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
    A                                                                   
4444C4444444444444444444444444444444444444444444444444444444444444444444
000010000000000000000000000000000000000000000000000000000000000000000000



STEP0001 produced output of 2 lines
Code:

                                                   
    A                                               



STEP0002 produced 1 line of output
Code:

    A                           



I was expecting the result to be the same for both steps ie. only 1 records out


Am I missing something ?


Gerry
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Jul 19, 2013 12:49 pm    Post subject: Reply to: INCLUDE condition for checking low values or space
Reply with quote

I think I must be :-)

Why are you expecting only one record output, when the first record of your input is neither 20 binary-zeros nor 20 spaces?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jul 19, 2013 1:00 pm    Post subject:
Reply with quote

Hi Bill,

does this
Code:
 SORT FIELDS=COPY                   
  OMIT COND=(1,20,CH,EQ,X'00',     
          OR,1,20,CH,EQ,X'40')     


equal this
Code:
 SORT FIELDS=COPY                                                   
  OMIT COND=(1,20,CH,EQ,X'0000000000000000000000000000000000000000',
          OR,1,20,CH,EQ,X'4040404040404040404040404040404040404040')



Gerry
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Jul 19, 2013 1:34 pm    Post subject: Reply to: INCLUDE condition for checking low values or space
Reply with quote

A guarded Yes. When I tried it, mine got rid of a line of 40 binary-zeros or 40 spaces, but retained lines containing at least one other character.

However, TS's code is equivalent, and doesn't work (in some unknown way).

I'm using DFSORT.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Jul 19, 2013 1:42 pm    Post subject: Re: Reply to: INCLUDE condition for checking low values or s
Reply with quote

Bill Woodger wrote:
Why are you expecting only one record output, when the first record of your input is neither 20 binary-zeros nor 20 spaces?
I got confused by the above statement, Gerry's input has spaces at pos 1-20 in record-1 right? icon_rolleyes.gif
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jul 19, 2013 2:11 pm    Post subject:
Reply with quote

Looks like when ever we need to provide X we need give the value equal to length in Include or OMIT

Coudlnt find any details of that in Manuals

Pretty strange for me

Edit: Also the same does not happen when using C' '
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jul 19, 2013 2:44 pm    Post subject:
Reply with quote

Hi,


I'm also using DFSORT.

Also my first record is all blanks.

Quote:
A guarded Yes. When I tried it, mine got rid of a line of 40 binary-zeros or 40 spaces, but retained lines containing at least one other character


Bill, just so I'm not confused, which of my 2 options did you use ?

Pandora-box, so you are getting the same results as I'm getting

Gerry
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jul 19, 2013 2:45 pm    Post subject:
Reply with quote

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

Moderator


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

PostPosted: Fri Jul 19, 2013 3:39 pm    Post subject:
Reply with quote

I had a look at the DFSORT manual and it is pretty much clear about field-to-constant comparison rules when the operands differ in length.

Quote:
Character and hexadecimal strings are truncated and padded on the right.

The padding characters are:

X'40' For a character string
X'00' For a hexadecimal string.

In Gerry's card, the comparison was with hexadecimal strings and as per the rule, both were padded with X'00' on the right before comparison.

So the equivalent of
Code:
  SORT FIELDS=COPY                                                   
  OMIT COND=(1,20,CH,EQ,X'0000000000000000000000000000000000000000',
          OR,1,20,CH,EQ,X'4040404040404040404040404040404040404040')
will be
Code:
  SORT FIELDS=COPY             
  OMIT COND=(1,20,CH,EQ,X'00', 
          OR,1,20,CH,EQ,C' ')

Hope this makes sense now.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Jul 19, 2013 4:35 pm    Post subject: Reply to: INCLUDE condition for checking low values or space
Reply with quote

That'll be it Arun.

I just can't bring myself to code X'40' instead of C' ', so that was how I tested. Then this morning I reaslised I'd not bothered to post the results, so just copied TS's stuff and re-arranged, so untested code, with the X'40' as in the original.

All now clear. The X'40' in 40 bytes looks for X'40' and 39 binary zeros. The C' ' looks for 40 spaces. The X'00' looks for 40 binary zeros.

EDIT:

I've updated the original to avoid confusion.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jul 19, 2013 8:11 pm    Post subject:
Reply with quote

Arun wrote:
I had a look at the DFSORT manual

Now, you've done it . . . Everyone will be reading manuals and not asking us to do icon_cool.gif

Good catch!

d
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sun Jul 21, 2013 4:43 am    Post subject: Reply to: INCLUDE condition for checking low values or space
Reply with quote

Hi,

another way to code this could be
Code:
 SORT FIELDS=COPY                   
  OMIT COND=(1,20,SS,EQ,X'00',       
          OR,1,20,SS,EQ,X'40')       




Gerry
Back to top
View user's profile Send private message
rammohan paulrajan

New User


Joined: 28 Nov 2007
Posts: 11
Location: chennai

PostPosted: Sun Jul 21, 2013 5:51 am    Post subject: Reply to: INCLUDE condition for checking low values or space
Reply with quote

Hi Dick,
My input records either will have all X'40' or all X'00' not a mixture of both. So I had 3 records with 40 length and one record had value, one record had all X'40' and one record had all X'00'. When I used the OMIT condition given, still I got all 3 records in the output file.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sun Jul 21, 2013 12:53 pm    Post subject: Reply to: INCLUDE condition for checking low values or space
Reply with quote

Then show the full sysout from your step, and show the three input records, in hexadecimal.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 22, 2013 3:07 am    Post subject:
Reply with quote

Hello,

Quote:
When I used the OMIT condition given, still I got all 3 records in the output file.
Because the Sort Control info is incorrect.

Until you do as asked and post the submitted job and the informational messages produced along with the 3 records (in hex), we can't be much help.
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am


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