View previous topic :: View next topic
|
Author |
Message |
Shilpa Joshi
New User
Joined: 22 Jun 2012 Posts: 3 Location: India
|
|
|
|
Hi,
I am trying to update a record of a PS file, and in the previous posting of the same kind, they have suggested to use PUTX macro and GET macro in locate mode.
If i am trying to update empname based on empid, how do i rewrite the record in the same file.
Looking forward for some pointers. Thank you. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Search for "Updating in Place" in DFSMS Using Data Sets. |
|
Back to top |
|
|
Shilpa Joshi
New User
Joined: 22 Jun 2012 Posts: 3 Location: India
|
|
|
|
*********************************************
*OPEN THE FILE IN UPDATE MODE
*********************************************
OPEN (INFIL,UPDAT)
MAINLINE EQU *
GET INFIL,RECORD
MVC INREC,RECORD
CLC EMPID,CMPID
BE UPDATE
BNE NOUPDATE
*PUT THE RECORD IN TO THE OUTPUT FILE
*********************************************
UPDATE MVC EMPNAME,=CL6'SHILPU'
TPUT INREC,L'INREC
MVC RECORD,INREC
PUTX INFIL,RECORD
B MAINLINE
NOUPDATE B MAINLINE
*AT END OF FILE, CLOSE THE FILE
*********************************************
EOF CLOSE (INFIL)
***********STANDARD EXIT*********************
L 13,SAVEAREA+4
RETURN (14,12),RC=0
*********************************************
BR 14
SAVEAREA DS 18F
INFIL DCB DDNAME=INFILE,
MACRF=GM,
BLKSIZE=800,
LRECL=80,
RECFM=FB,
DSORG=PS,
EODAD=EOF
RECORD DS CL80
INREC DS 0CL80
EMPID DS CL6
EMPNAME DS CL20
DS CL54
CMPID DC CL6'E174751'
END FILEUPDT
No errors, when i run this code, but the file is not getting updated. Could you please tell me what changes has to be done to the code? |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
You can use GET and PUTX macros. To use PUTX, code MACRF=(GL,PL) on the DCB macro.
You didnt do that, so you didnt read the Updating in Place part of the manual. |
|
Back to top |
|
|
Shilpa Joshi
New User
Joined: 22 Jun 2012 Posts: 3 Location: India
|
|
|
|
I have changed MACRF=(GL,PL), no errors though, but nothing is getting updated in the file.
I read the updating in place, but they have used read and write. My mistake,that i didnt change MACRF to (GL,PL) in my earlier post.
Thank you. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Do NOT multi-post the same question.
As mentioned in your other topic, it is bad design to overwrite records in a sequential file. Even if you find a way, it should NOT be used. |
|
Back to top |
|
|
|