MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Replace field value in table for all occurance thru File-aid

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ganesh_b
Beginner


Joined: 06 Apr 2005
Posts: 12
Topics: 2

PostPosted: Fri Jun 10, 2005 7:02 am    Post subject: Replace field value in table for all occurance thru File-aid Reply with quote

Hi,

I have a file which has table with 15 occurances. One of the field in the table has junk value and need to replace those junk with spaces in all the occurance of the table.

Please let me know how this can be achieved thru Fileaid.
_________________
Ganesh.B
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Fri Jun 10, 2005 8:01 am    Post subject: Reply with quote

Ganesh,

Quote:

One of the field in the table has junk value and need to replace those junk with spaces in all the occurance of the table.


Define what you meant by junk values. Once you have defined them then , the check the following topics and change them according to your requirements.

http://www.mvsforums.com/helpboards/viewtopic.php?t=314&highlight=replall

http://www.mvsforums.com/helpboards/viewtopic.php?t=941&highlight=replall

http://www.mvsforums.com/helpboards/viewtopic.php?t=766&highlight=replall

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ganesh_b
Beginner


Joined: 06 Apr 2005
Posts: 12
Topics: 2

PostPosted: Tue Jun 14, 2005 4:11 am    Post subject: Reply with quote

Kolusu,

Thanks for providing the links. I have understood the way how the value can be replaced in the complete file.

Code:

//STEP0100 EXEC PGM=FILEAID,REGION=0M                       
//*                                                         
//SYSLIST  DD SYSOUT=*                                       
//SYSPRINT DD SYSOUT=*                                       
//SYSUDUMP DD SYSOUT=*                                       
//DD01     DD *
FIELD1:XXXXXKOLUSU                         
              FIELD1:XXXXXDALALY           
                       FIELD1:XXXXXNAVEEN                                               
//DD01O    DD SYSOUT=*                                       
//SYSIN    DD *                                             
$$DD01 COPY REPLALL=(01,00,C'FIELD1:',C'FIELD1:FFFFF'),OUT=0
/*   


I believe that "01" represents the starting position and "00" represents the EOF. I have tried this by changing the starting and ending position and that too works fine. But when I try to restrict the position as follows, I am getting the following error message.

[code]
1...5...10...15...20...25...30...35...40...45...50...55...60...65...7

DD01 DSN=FILE1 OPENED AS KSDS,
LRECL=1255,KEYLEN=17,NRECRDS=1,CINV=7680,MAXRBA=691200,V
DD01O DSN=FILE2 OPENED AS PS,
RECFM=F,LRECL=1255,BLKSIZE=1255,VOL=TSX330
$$DD01 COPY REPLALL=(286,2,C'10',C'20')
1...5...10...15...20...25...30
DATA EXCEEDS SCAN LENGTH IN REPLALL, CHECK DATA STARTING IN COLUMN 30
.....SKIPPING TO NEXT $$DD CARD
[code]

Checked and made sure that the field trying to replace is only of 2 bytes.

I have changed the control card as follows which is working fine.

[code]
$$DD01 COPY REPLALL=(286,3,C'10',C'20')
[code]

Sorry for not posting my requirement clear. Let me try to make it here.

[code]
Table defined as 15 occurance with 2 fields.
XXXX-LCHANGE-OP-ID-1(1) (starting position - 284, length - 4)
YYYY-CREATED-OP-ID-1(1) (starting position - 288, length - 4)
[code]

It is possible to have both these variables holding the same value. i.e created & changed by same person. In this case, if I need to change ONLY the LCHANGE-OP-ID to "BBBB" if it is "AAAA" for all the 15 occurance, how can I acheive this thru FileAid.
_________________
Ganesh.B
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Jun 14, 2005 5:25 am    Post subject: Reply with quote

Ganesh,

You cannot use REPLALL function as there is a likely chance of overlaying the CREATED-OP-ID.

So you need individual replace cards instead of replace all. So try this. I haven't tested them out.

Code:

$$DD01 COPY IF=(288,EQ,C'AAAA'),       
            REPL=(284,C'BBBB'),       
            REPL=(292,C'BBBB'),       
            REPL=(300,C'BBBB'),       
            REPL=(308,C'BBBB'),       
            REPL=(316,C'BBBB'),       
            REPL=(324,C'BBBB'),       
            REPL=(332,C'BBBB'),       
            REPL=(340,C'BBBB'),       
            REPL=(348,C'BBBB'),       
            REPL=(356,C'BBBB'),       
            REPL=(364,C'BBBB'),       
            REPL=(372,C'BBBB'),       
            REPL=(380,C'BBBB'),       
            REPL=(388,C'BBBB'),       
            REPL=(396,C'BBBB'),OUT=0   



Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ganesh_b
Beginner


Joined: 06 Apr 2005
Posts: 12
Topics: 2

PostPosted: Tue Jun 14, 2005 8:54 am    Post subject: Reply with quote

Kolusu,

Thanks. I have tried and it is working fine. I have to check LCHANGE-OP-ID for "AAAA" on each occurance before doing a replace.

Did you get a chance to look at the other problem mentioned.

Code:

$$DD01 COPY REPLALL=(286,3,C'10',C'20')


I have removed "OUT=0" and tried and could not see any difference. What will "OUT=0" do?
_________________
Ganesh.B
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Jun 14, 2005 9:06 am    Post subject: Reply with quote

Quote:

Did you get a chance to look at the other problem mentioned.


Ganesh,

The batch reference manual of file-aid will answer all your queries. You don't have to mention the length for fileaid control cards , you just need the start position of string. so remove the 3 which you coded for the length of the string.

Quote:

I have removed "OUT=0" and tried and could not see any difference. What will "OUT=0" do?


The OUT parameter controls the number of records that are written or printed before processing stops. OUT=0 means write out all the input records. The default is 250 records. However it seems that your shop has OUT=0 as default.

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ganesh_b
Beginner


Joined: 06 Apr 2005
Posts: 12
Topics: 2

PostPosted: Wed Jun 15, 2005 1:52 am    Post subject: Reply with quote

Kolusu,

Thanks for your help.
Referred batch reference manual for the other problem mentioned.

Code:

Replace by Condition
REPL=(location,{length },[dupl]compare-data,[dupl]new-data)
{operator}

location: Starting location of the data to check and/or replace. Any actual or relative location can be used.

length: Length of the area to check. The value must be at least one byte longer than the compare-data length. Use 0 to scan until the end of the record.

_________________
Ganesh.B
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Wed Jun 15, 2005 5:28 am    Post subject: Reply with quote

Ganesh,

please note the length field is an optional field in curly brackets.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ganesh_b
Beginner


Joined: 06 Apr 2005
Posts: 12
Topics: 2

PostPosted: Wed Jun 15, 2005 8:03 am    Post subject: Reply with quote

Kolusu,

I have tried by removing the length and getting the following error message.

Code:

1...5...10...15...20...25...30...35...40...45...50...55...60...65.
                                                                 
DD01     DSN=FILE1 OPENED AS KSDS,       
             LRECL=1255,KEYLEN=17,NRECRDS=1,CINV=7680,MAXRBA=69120
DD01O    DSN=FILE2 OPENED AS PS,         
             RECFM=F,LRECL=1255,BLKSIZE=1255,VOL=TSX014           
$$DD01 COPY REPLALL=(286,,C'10',C'20')                           
1...5...10...15...20...25.                                       
LENGTH NOT SPECIFIED FOR REPLALL, CHECK DATA STARTING IN COLUMN 26
.....SKIPPING TO NEXT $$DD CARD                                   


Code:

1...5...10...15...20...25...30...35...40...45...50...55...60...65...
                                                                   
DD01     DSN=FILE1 OPENED AS KSDS,         
             LRECL=1255,KEYLEN=17,NRECRDS=1,CINV=7680,MAXRBA=691200,
DD01O    DSN=FILE2 OPENED AS PS,           
             RECFM=F,LRECL=1255,BLKSIZE=1255,VOL=TSX346             
$$DD01 COPY REPL=(286,,C'10',C'20')                                 
1...5...10...15...20...                                             
INVALID LENGTH OR OPERATOR IN REPL, CHECK DATA STARTING IN COLUMN 23
.....SKIPPING TO NEXT $$DD CARD                                     

_________________
Ganesh.B
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Wed Jun 15, 2005 8:20 am    Post subject: Reply with quote

Ganesh,

*sigh* You have an extra comma after the start pos.

When you use REPLALL you need to specify length, as "ALL" is applicable to the entire lrecl.

When you use REPL the you are changing only one position. In that case you don't need the length ,but you do need a relational operator (EQ, NE, GT, LT...)

so change your control cards to the following.

Quote:

$$DD01 COPY REPL=(286,EQ,C'10',C'20')


The above control cards will replace the content at 286 to 20 if the value is 10.

Hope this helps...

Cheers

kolusu

Ps: Since you have the batch refence fileaid manual , I suggest that you spend sometime reading it.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ganesh_b
Beginner


Joined: 06 Apr 2005
Posts: 12
Topics: 2

PostPosted: Wed Jun 15, 2005 8:20 am    Post subject: Reply with quote

Kolusu,

I have tried the following and it worked.

Code:

$$DD01 COPY REPL=(286,EQ,C'10',C'20')


Code:

Replace by Condition:
REPLALL=(location,length,compare-data,[dupl]new-data)

Replace at Alternate Location Depending on a Condition:
REPLALL=(location,length,compare-data,replace-location,
[dupl]new-data)


I believe Length should be specified for REPLALL command.
_________________
Ganesh.B
Back to top
View user's profile Send private message
ganesh_b
Beginner


Joined: 06 Apr 2005
Posts: 12
Topics: 2

PostPosted: Wed Jun 15, 2005 8:43 am    Post subject: Reply with quote

Kolusu,

Thanks for all of your responses. I think we have edited the post to reply at same time.

Regarding the extra comma, I gave it as the length alone is given in curly brackets and hence thought that way.

Code:

Replace by Condition
REPL=(location,{length },[dupl]compare-data,[dupl]new-data)
{operator}

location: Starting location of the data to check and/or replace. Any actual or relative location can be used.

length: Length of the area to check. The value must be at least one byte longer than the compare-data length. Use 0 to scan until the end of the record.

_________________
Ganesh.B
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group