View previous topic :: View next topic
|
Author |
Message |
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
Hi,
My requirement is to find out the record when the name field X(30) satisfies
any one of following condition.
1. If the first character of name field is space.
Example for this
2. The name field may have LOW-VALUE at any place, the position of low-value is not fixed. I will select the record if the immediate first character after any LOW-VALUE is space.
Example for this
Here HEXCODE 40 - Space, 00 - LOWVALUE
In COBOL it can solved by UNSTRING by LOW-VALUES. But i want to know is there any possibility to achieve this using SORT utility..
[/code]
Thanks in advance
R KARTHIK |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,1,CH,EQ,C' ',OR,
1,30,SS,EQ,X'0040')
/*
|
|
|
Back to top |
|
|
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
Hi Frank,
Thanks. It s working. But i dont want the record to o/p file for the following case.
Code: |
BICKFO RD ALFRED
CCCDCD DC0CDCDCC04444
293266 94013695400000
|
Here the length of name BICKFORD ALFRED is 15 and there is no occurence of X'0040' within that length. After that i dont want to check for X'0040'. So i want to check the condition X'0040' only within the name. For each record the length of the name may change. The maximum length is 30.
Kindly clarify this case,
Regards
R KARTHIK |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
For each record the length of the name may change. |
And what exactly is the "rule" for determining the length of the name (that is, where the name ends)?
Quote: |
Here the length of name BICKFORD ALFRED is 15 |
And how can we determine that programmatically? What indicates that the name ends after 15 characters?
I gave you a solution based on what you told me. Was I supposed to read your mind to know that the names "end" based on some "rule" that you didn't tell me about and still haven't explained? In the future, please try to describe your "requirement" completely in your first post to save us all time. |
|
Back to top |
|
|
|