View previous topic :: View next topic
|
Author |
Message |
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
I want to update the input file
Requirement :
Input file is VSAM file. Get the particular column from the VSAM file and copy in to a sequential dataset.
VSAM file DATA
ABCDEFGHIJKLMNOPQRSTUVWXYZ
USING OUTREC FIELDS GET THE PQR IN TO FLAT FILE .
FLAT FILE DATA
PQR
NOW I WILL EDIT THE FLAT FILE DATA.. (SAY SOME OTHER APPLICATION WILL MODIFY THE DATA)
NOW FLAT FILE WILL HAVE
INSTEAD OF PQR IT HAS 123 ..
NEXT I WILL USE THIS FLAT FILE HAVING DATA 123 I WILL BE USING INPUT IN THE NEXT STEP AND UPDATE THE POSTION IN THE VSAM FILE HAVING DATA SHOULD BE REPLACED BY
EXISITING: ABCDEFGHIJKLMNOPQRSTUVWXYZ
THE FINAL OUTCOME SHOULD BE
:ABCDEFGHIJKLMNO123STUVWXYZ
PLEASE LET ME KNOW IF YOU NEED MORE DETAILS |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Why go to the bother of unloading a subset of the file, updating that subset, reconstructing records to put back into the VSAM file and then actually returning them to the VSAM file.
Why not just process the whole record using SORT or even a program to update in place.
1) Backup of file
2) Update of file
But ...............
Will every record be updated ?
Will the record key be part of the unloaded subset ? If not, how will you know where each updated subset goes in relation to the VSAM key ? |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
The Things is the system which updates tha will support the flat file not vsam file and the and reclength should be 3000 .. the vsam file is having length more than 3000.
thats the reason getting the data to flat file and making 3000 length to call the opther system to update the fields..
so i would say this is the best approach .. using program we can do it.. but
i want it by JCL .. this will increase the produtvity |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
|
|
let' s see if I got Your requirement right
You have a dataset ( it' s organization is irrelevant for the logic )
whenever at a certain offset/position for a certain lenght there is a certain string,
You want to substitute that string with something else...
right ??
in other words from Your sample records
Code: |
123456789012345678901234567890
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNO123STUVWXYZ
|
every occurrence of PQR at position 16 must be substituted with 123
right ??
otherwise clarify better, what You want to do...
not how You think You might do it
pleease |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
i Have a file
file 1
1234567890123456789
I will get the field starting @ position 10 - 14 of length 5 in to seperate file FILE 2 using OUTREC FIELDS
now File 2 will have ( here i am editing it manually ,, but some other apllication will use this file and update the fields)
01234
Now i will edit the File 2 with
ABCDE
So the updated field in the file 2 has to replace the postion mentioned in the FILE 1 i. e 10 - 14
so o/p file should look as
123456789ABCDE56789
Please let me know how i can achieve this ..
please let me know if you need more details |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
Please have look @ this |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Enrico,
This is the bit that gives me some serious concerns.....
OP can only process records of 3000 bytes, but the VSAM records are longer than 3000. I think that this will require a programmed solution to merge the download amended 3000 byte records with the correct 3000+ part of the record still in the VSAM file.
sanjayis01 wrote: |
The Things is the system which updates tha will support the flat file not vsam file and the and reclength should be 3000 .. the vsam file is having length more than 3000. |
Quote: |
i want it by JCL .. this will increase the produtvity |
Unfortunately, what you want and what you need to do are often very different animals. |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
That i can manage i will conver vsam to flat file ..
please consider this as simple flat file ..
please let me know the solution... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
|
|
You did not reply to my question !!
for the change process do You already know the from string and the to string
or that info is hidden in some other database/dataset |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
Could you please clear doubt again ???
i did not get ..
i think i have given all the information . i think what u have understood previously its correct.. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
|
|
the difference is between having to run four steps instead of two
if You know the from string an the to string
You can run a
dfsort step to create a dataset with the changed columns/fields
dfsort step to reload the vsam
in the other case You have to run
dfsort step to extract the from string
some_user_program to build the from to relation strings
dfsort step to create a dataset with the changed columns/fields
dfsort step to reload the vsam |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
please let me know how i can achieve this
dfsort step to create a dataset with the changed columns/fields |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
Hi All
Please let me knw the solution |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
|
|
I do not want /cannot give a working sample because I cannot test it right now
if You search the dfsort/icetool forum You will find lots of samples
here is a pointer to a thread that looks good
http://ibmmainframes.com/viewtopic.php?t=30503&highlight=ifthen+overlay+copy
snippet taken from there not tested
adjust the offset to Your need and exercise on a small dataset first
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(9,3,CH,EQ,C'CAN'),
OVERLAY=(9:C'CTN'))
IFTHEN=(WHEN=(9,3,CH,EQ,C'CDN'),
OVERLAY=(9:C'CSR')),
IFTHEN=(WHEN=(9,3,CH,EQ,C'CON'),
OVERLAY=(9:C'CXT'))
/* |
anyway the sort manual is always the best reference |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
The problem is in the above example u mentioned is
They know the what data they are getting in the input file.. i dont know what data is coming and by what i wil be updating ..
every time i will be getting different number only . i only know the psotion
so in that case how i can handle it.. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
sanjayis01,
You can create a DFSORT symbol to update the field. However you need to retain the old value also to be able update it once again. So when picking the the bytes to be replaced we create 2 files
Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1234567890123456789
//ACTUAL DD DSN=YOUR.ACTUAL.VALUE FILE,DISP=(,CATLG),SPACE=(TRK,(1,1),RLSE)
//UPDATE DD DSN=YOUR.UPDATE.VALUE FILE,DISP=(,CATLG),SPACE=(TRK,(1,1),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=ACTUAL,
BUILD=(C'ACTUAL_FIELD,C',C'''',10,5,C'''',80:X)
OUTFIL FNAMES=UPDATE,
BUILD=(C'UPDATE_FIELD,C',C'''',10,5,C'''',80:X)
/*
|
Now you have 2 files.
The actual file looks like this
Code: |
ACTUAL_FIELD,C'01234'
|
The UPDATE file looks like this
Code: |
UPDATE_FIELD,C'01234'
|
Now take this update file and modify(manually or programatically) the contents in pos 16 for 5 bytes which would then look like this
The UPDATE file will NOW look like this
Code: |
UPDATE_FIELD,C'ABCDE'
|
Now concatenate these 2 files to SYMNAMES DD and use that to update the original file
Code: |
//STEP0300 EXEC PGM=ICEMAN
//SYMNAMES DD DSN=YOUR.ACTUAL.VALUE FILE,DISP=SHR
// DD DSN=YOUR.new updated.VALUE FILE,DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1234567890123456789
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(10,5,CH,EQ,ACTUAL_FIELD),
OVERLAY=(10:UPDATE_FIELD))
/*
|
Hope this helps...
Cheers |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
Hi
thanks for reply , i think this could work for me . i will test it and post the reply ..
mean while i got few question .. please let me know the answers for the below
could you please explain this again
//ACTUAL DD DSN=YOUR.ACTUAL.VALUE FILE,DISP=(,CATLG),SPACE=(TRK,(1,1),RLSE)
//UPDATE DD DSN=YOUR.UPDATE.VALUE FILE,DISP=(,CATLG),SPACE=(TRK,(1,1),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=ACTUAL,
BUILD=(C'ACTUAL_FIELD,C',C'''',10,5,C'''',80:X)
OUTFIL FNAMES=UPDATE,
BUILD=(C'UPDATE_FIELD,C',C'''',10,5,C'''',80:X)
For what purpose this actual file is used..?
and also please explain me this card
BUILD=(C'ACTUAL_FIELD,C',C'''',10,5,C'''',80:X)
how can i mention the psotion in this ? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
The actual field is used to update the input file where you picked the value as you are overlaying the contents with something else
In the above control cards I am picking the value at pos 10 for 5 bytes |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
OUTFIL FNAMES=ACTUAL,
BUILD=(C'ACTUAL_FIELD,C',C'''',10,5,C'''',80:X)
OUTFIL FNAMES=UPDATE,
BUILD=(C'UPDATE_FIELD,C',C'''',10,5,C'''',80:X)
i am not familiar with this syntax please explain me in brief what each fiels indicates in the BUILD CARD. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
C'ACTUAL_FIELD,C' will populate a constant ACTUAL_FIELD,C at pos 1
C'''' will put a single quote following the last field
10,5, will copy the contents from pos 10 for a length of 5 bytes
C'''' will again put another single quote
80:X will pad up to 80th byte with spaces
the output will look like this
Code: |
ACTUAL_FIELD,C'01234'
|
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links
Hope this helps...
Cheers |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
Thanks lot.. man
Its working nicely...
hats off.. |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
Suppose i want update multiple column in the same way means
how can i proceed???? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
sanjayis01
From the sysout you have sent via private message , it appears that you are using syncsort.
I'm a DFSORT developer. DFSORT and Syncsort are competitive products.
I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I
don't answer questions on Syncsort. |
|
Back to top |
|
|
|