Joined: 08 Aug 2007 Posts: 10 Location: Dalian, China
How about this:
Code:
INCLUDE COND=(1,5,CH,EQ,50C'A')
Words from getting started:
The format for repeating a character string is:
nC’x...x’
where n can be from 1 to 4095; n repetitions of the character string (C'x...x') are inserted into the reformatted records. If n is omitted, 1 is used instead.
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
Arun Kumar Tupili
Can we clarify exactly what it is you want to do. You started by saying that you wanted to sort the file, and now we see that you actually appear to want to select certain records using the COPY option.
Also could you clarify which sort product you are using as the statments wmay vary between the two main products.
Also post your error messages and output to get faster assitance.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
.rant on
Arrghhh!!! SCANDY and others - Would you people please stop giving lousy advice as if you know what you're talking about!
Quote:
How about this:
INCLUDE COND=(1,5,CH,EQ,50C'A')
Words from getting started:
The format for repeating a character string is:
nC’x...x’
where n can be from 1 to 4095; n repetitions of the character string (C'x...x') are inserted into the reformatted records. If n is omitted, 1 is used instead.
You're quoting from the syntax for OUTREC, not INCLUDE. OUTREC allows nC'x...x' - INCLUDE doesn't.
I'm getting really tired of correcting the misinformation constantly given by some people in this forum. My timezone means everyone gets to respond before I do and then I have to clean up the mess. Cut it out. If you can't test a "solution", then please don't post it. If you don't have time to look things up in the DFSORT book to make sure you know what you're talking about, then please don't post. I really don't have time to correct all of this stuff. If you're not absolutely sure you have the correct solution to a DFSORT or ICETOOL question, please just let me answer it - it will save everybody time.
.rant off
Now getting back to the original post - Arun - it isn't clear what you're trying to do - please clarify what you want. Are you trying to INCLUDE records where the 50 byte field is all 'A's or are you trying to do something else? Is there more than one constant? Do you have the constants in a file somewhere? Please give more details.
I am sorry for mentioning Sort. I want to Include the records in a file based on a key value which is of length 50 bytes(same character repeating for 50 times).
For Example
QW AAAAA 1234 Steeet1
WE AAAAA 1123 Street2
We can use the INCLUDE COND=(4,5,CH,EQ,C'AAAAA')
It is okay if the number of characters in the keyfiled are less.
But if the same char is repeating in the key field for 50+ times as shown below
ZX AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.... 2341 Street2, its difficult for typing INCLUDE COND=(4,5,CH,EQ,C'AAAAA.......').
Isn't there any other way of reducing in typing the same char in include condition.
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
Arun Kumar Tupili,
Character "*" in the position 72 play as a continuation of next line for sort cards.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
INCLUDE COND=(4,50,CH,EQ,C'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*
AAAAAAA')
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
Arun Kumar Tupili,
Please continue the next line on 16th column if "*" is used as a continuation in position 72.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
INCLUDE COND=(1,50,CH,EQ,C'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*
AAAAAAA')
What I meant was, typing 50 times woudn't be feasible. What if the character appears in the keyfiled for 1500 times. In that senario, typing the same character 1500 times is hectic.
I just want to know if there is any shortcut to avoid in repeated typing of the same char in Include Cond.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
There's no direct shortcut. You could generate the constant as a symbol and then use that symbol. For example, for 50 A's, you could generate a DFSORT symbol and use it like this:
However, that method will only work for a maximum constant of 50 bytes (the limit for a Symbol constant).
Generating the actual control statement rather than just the symbol would allow you to use a larger constant. But the maximum length for an INCLUDE constant is 256 bytes so your example of repeating a character 1500 times would be invalid.
Thanks for the solution. It worked .
Could you please clarify the syntax for
INREC BUILD=(C'C1,''',50C'A',C'''',80:X) .
Why are there 3 single quotes after C1 and 4 quotes after 50C'A'. What do they represent .
To represent a character string constant (say O'Neil ) we can write as
C1,C'O''Neil' . But we weren't able to make out the same from 50C'A' as mentioned by you in INREC bUILD above.
Is it that 80th col should always have a space ?
Can we include the rest of the fields from i/p file in the INREC BUILD .
If you could throw more light on this it"ll help us a lot.
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
As single quote are used for enclosing some data in sort cards such as C'xxxxx',X'xxxxx',....,it's not possible to print the single quote in output directly by coding as single quotes itself. So they designed a architecture such that two single quotes will print a single "single quote" in output.
If you want to print ' in output, code as ''
If you want to print '' in output, code as ''''
If you want to print ''' in output, code as ''''''
If you want to print '''' in output, code as ''''''''
.
.
.
.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
Could you please clarify the syntax for
INREC BUILD=(C'C1,''',50C'A',C'''',80:X) .
Why are there 3 single quotes after C1 and 4 quotes after 50C'A'. What do they represent .
When using C'string' you need two apostrophes for each apostrophe in the string.
C'C1,''' = C1,'
50C'A' = A...A
C'''' = '
So the string is C1,'A...A' - this creates a symbol named C1 for A...A (50 A's).
Quote:
Is it that 80th col should always have a space ?
Symbol statements must be 80 bytes long so we use 80:X to make the records 80 bytes long.
Quote:
Can we include the rest of the fields from i/p file in the INREC BUILD.
I don't understand your question. In S1, we're building a symbol named C1. In S2, we're using C1 in an INCLUDE statement. S1 does not use the input file - it just uses a SYSIN record. S2 uses the input file. I don't know where you want to "include the rest of the fields from the i/p file". You need to explain what that means and what you want to do that requires it.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
If you want to print ' in output, code as ''
If you want to print '' in output, code as ''''
If you want to print ''' in output, code as ''''''
If you want to print '''' in output, code as ''''''''
Actually, that should be:
If you want to print ' in output, code as C''''
If you want to print '' in output, code as C''''''
If you want to print ''' in output, code as C''''''''
If you want to print '''' in output, code as C''''''''''
I have a doubt on SYMNAMES . Can SYMNAMES be used instead of INREC BUILD=(C'C1,''',50C'A',C'''',80:X) i.e. can the symbol C1 used here be generated using SYMNAMES ? If so what should be the syntax .
In SYMNAMES we can write C1 as
C1,C'AAAA.......AAA' i.e. (A 50 times in quotes). How to avoid typing A 50 times with SYMNAMES. Is it possible using SYMNAMES ?
I had asked if we can include the fileds from i/p file using INREC BUILD . It's just a query on the INREC BUILD statement only.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
How to avoid typing A 50 times with SYMNAMES. Is it possible using SYMNAMES ?
You seem to be missing the whole point of the solution. It does let you avoid typing A 50 times by using 50C'A' instead. When you look at my solution, do you see 50 A's typed anywhere? No, you don't. You see 50C'A'.
Step S1 creates one Symbol record in SORTOUT (&&S1). SORTIN has one record for input to give one record for output. The INREC converts the one "dummy" input record (it could be anything including all blanks) to an 80-byte output record in SORTOUT with a Symbol statement containing 50 A's like this:
Code:
C1,'A....A'
That's the Symbol statement you need for your 50 A's, but you didn't have to type all the A's since you used 50C'A' instead. The Symbol statement equates C1 to a constant of 50A's. You then use that SORTOUT data set (&&S1) as the SYMNAMES input for step S2 allowing you to use the C1 symbol in the INCLUDE statement of step S2:
Code:
INCLUDE COND=(4,50,CH,EQ,C1)
So:
Step S1 creates the Symbol statement in &&S1 which equates C1 to a constant of 50 A's.
Step S2 uses &&S1 as SYMNAMES. C1 is then available for the INCLUDE statement.
INREC BUILD=(C'C1,''',50C'A',C'''',80:X) .
Why are there 3 single quotes after C1 and 4 quotes after 50C'A'. What do they represent .When using C'string' you need two apostrophes for each apostrophe in the string.
C'C1,''' = C1,'
50C'A' = A...A
C'''' = '
So the string is C1,'A...A' - this creates a symbol named C1 for A...A (50 A's).
Frank i am not clear on this syntax (C'C1,''',50C'A',C'''',80:X).
C'''' that appears in INREC is explained as 1 apostrophe(') in your explanation given above. My doubt is , why is it written as ,C'''', and why not as ,'''', because in C1,' the apostrophe after C1, is represented as ''' not as C'''. On submitting the JCL with '''' it throws syntax error .
, but it works fine with C'''' . Please explain why is it so.
Could you please throw more light on this.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
C'string' defines a constant string constant. The string must be preceded by C' and followed by '. To define an apostrophe in a string, you must use two apostrophes.
C'''' is C'string' where string is '' (an apostrophe represented by two apostrophes). '''' is invalid because it is not preceded by C.
C'C1,''' is C'string' where string is C1,'' (C1, and an apostrophe represented by two apostrophes).
I don't know how to explain it better than that.
If the apostrophe characters confuse you, then perhaps this equivalent version of the INREC statement using X'7D' for the apostrophe will be easier to understand: