View previous topic :: View next topic
|
Author |
Message |
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Hi,
I have to create job which puts an 'X' at the 512 position in file.
Without changing file length, or without changing any other positions.
If on 512th position any other character than 'X' present then replace it by 'X'
Thanks |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Vikas,
I am assuming that file length is 512 bytes. Please find below sort card to change 512 position with X
OPTION COPY
INREC FIELDS=(1,511,C'X') |
|
Back to top |
|
|
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Thanks Ekta
It's working.
Vikas. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Even simpler with DFSORT would be to use OVERLAY (and it doesn't matter what the record length is):
Code: |
OPTION COPY
INREC OVERLAY=(512:C'X')
|
|
|
Back to top |
|
|
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Hi all,
I want to inserts zeros(or char's) at specific position in file.
Suppose input file length is 200 & i want to replace 100 to 105 characters by Zero's.
Vikas. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
The question was already asked by you, and answered, here. |
|
Back to top |
|
|
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Hi Superk,
I tried the solution given by you & Ekta it's working fine for inserting single/multiple character at the end of file only.
Now in anywhere in the file i want to replace characters.
Thank you,
Vikas |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Vikas,
Quote: |
Now in anywhere in the file i want to replace characters |
Its same.
OPTION COPY
INREC OVERLAY=(100:C'00000') |
|
Back to top |
|
|
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Hi murmohk1
I tried the solution given above it gives ABENDED S000 U0016.
Reason code 0000.
I use Syncsort.
Vikas. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Same idea, slightly different syntax, look at your Syncsort manual, the answer (and example) is there. |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
hey,
I dont think Syncsort will give an abend for the code Murmokh has given above.
Anyway try this code also.
Code: |
SORT FIELDS=COPY
INREC FIELDS=(1,100,C'00000',105,95) |
or
Code: |
SORT FIELDS=COPY
INREC OVERLAY=(100:C'00000') |
|
|
Back to top |
|
|
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Hi all,
I used the following,
Code: |
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,254,255:C'XXXXX',260:260,253) |
It will put xxxxx at 255-259 position.
Thanks to all,
Vikas |
|
Back to top |
|
|
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Hi All,
Suppose from input file
1. If some condition matches then I want to replace 200 to 205 chars by xxxx
2. Else I want to replace 200 to 205 chars by yyyy
The condition 1 can become true anywhere in the record. i need to check only 200 to 205th position & to write all records into one output file as it was present (same sequence as in original file) in the input file by using Syncsort.
If anyone knows how to give IF condition in SORT or any other idea then please let me know.
Thanks,
Vikas. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Support for IFTHEN, OVERLAY, and BUILD was built into SyncSort for z/OS 1.2.1.0 and later. What release of SyncSort are you currently running? |
|
Back to top |
|
|
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Hi i uses Syncsort version 1.2.1.1R.
Thanks,
Vikas |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Then you ought to be able to do what you want by using IFTHEN on the INREC and/or OUTREC statements.
There is a nice Addendum about BUILD, IFTHEN, IFOUTLEN, and
OVERLAY Parameters and some additional material titled Exploiting Synsort Join. If you don't already have them, get intouch with SyncSort Mainframe Support at zos_tech@syncsort.com (from your company email) and tell them Alissa Margulies sent you. |
|
Back to top |
|
|
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Yes William, I tried out IFTHEN & OVERLAY but the job abends.
I tried this
Code: |
INREC IFTHEN=(WHEN=(200,204,CH,EQ,C'ABCD'),
OVERLAY=(200:C'XXXX')),
INREC IFTHEN=(WHEN=NONE,
OVERLAY=(200:C'YYYY'))
SORT FIELDS=COPY |
In dump the messages are
'INCLUDE/OMIT INVALID LENGTH'
'NO KEYWORDS FOUND ON CONTROL STATEMENT'
Could you please provide me sample SORT CARD, So that I will get some Idea? The above code I written by referring Syncsort mannual.
Thanks,
Vikas. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
I'm not positive, but at a quick look, it apperars as though this
Quote: |
WHEN=(200,204,CH,EQ,C'ABCD' |
specifies a length of 204 - not what you want.
Starting your control statements in other than position 1 will help as well. Most working examples people post here use 2 spaces before the contorl info begins. |
|
Back to top |
|
|
VIKAS GAIKWAD
New User
Joined: 30 Nov 2006 Posts: 33 Location: MUMBAI
|
|
|
|
Hi,
I used following card in DFSORT enviornment. Now it's working.
Code: |
INREC IFTHEN=(WHEN=(200,4,CH,EQ,C'ABCD'),OVERLAY=(200:C'YYYY'))
OUTREC IFTHEN=(WHEN=(256,4,CH,EQ,C'PQRS'),OVERLAY=(200:C'XXXX'))
SORT FIELDS=COPY |
Thanks William.
Thanks,
Vikas. |
|
Back to top |
|
|
kbmkris
Active User
Joined: 24 Jun 2006 Posts: 101
|
|
|
|
hi Vikas,
check with the following code,
Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(200,6,DT,COND,CRITERIA),OVERLAY=(200:C(XXXXXX)),
IFTHEN=(WHEN=(200,6,DT,COND,CRITERIA),OVERLAY=(200:C(YYYYYY))
DT - datatype
Hope this helps you.
Please correct if i am wrong
Thanks,
Bala |
|
|
Back to top |
|
|
kbmkris
Active User
Joined: 24 Jun 2006 Posts: 101
|
|
|
|
hi everyone,
i haven't initially noticed that there is a next page. sorry :-(
Thanks,
Bala |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Not to worry |
|
Back to top |
|
|
|