Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Updating the input file
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 9:30 am    Post subject: Updating the input file
Reply with quote

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
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue May 20, 2008 11:33 am    Post subject:
Reply with quote

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
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 11:49 am    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue May 20, 2008 5:51 pm    Post subject: Reply to: Updating the input file using JCL
Reply with quote

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
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 5:58 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 6:43 pm    Post subject:
Reply with quote

Please have look @ this
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue May 20, 2008 6:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 6:59 pm    Post subject: Reply to: Updating the input file
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue May 20, 2008 7:04 pm    Post subject: Reply to: Updating the input file
Reply with quote

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
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 7:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue May 20, 2008 7:18 pm    Post subject: Reply to: Updating the input file
Reply with quote

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
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 7:31 pm    Post subject:
Reply with quote

please let me know how i can achieve this

dfsort step to create a dataset with the changed columns/fields
Back to top
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 9:30 pm    Post subject:
Reply with quote

Hi All

Please let me knw the solution icon_sad.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue May 20, 2008 9:48 pm    Post subject: Reply to: Updating the input file
Reply with quote

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 icon_biggrin.gif
Back to top
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 9:57 pm    Post subject: Reply to: Updating the input file
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 20, 2008 10:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 10:42 pm    Post subject: Reply to: Updating the input file
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 20, 2008 10:53 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue May 20, 2008 10:56 pm    Post subject: Reply to: Updating the input file
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 20, 2008 11:37 pm    Post subject:
Reply with quote

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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html


Hope this helps...

Cheers
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us