View previous topic :: View next topic
|
Author |
Message |
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
I have an employee information file which has a field to hold the location. My requirement is to update the zipcode of a only one location with a new value.
Thanks,
Balaji |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
For anyone to help, you need to provide something to work with. . .
You need to post some input data (enough to represent whatever possibilities could occur in the real data), the output you want from that input, and the rules to get from the input to the output.
You should also mention the recfm and lrecl of the files as well as the positions in the record of the relevant fields (and the data type if it matters). |
|
Back to top |
|
|
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
Below is a sample file
Input file
Code: |
EID Name State ZIPCODE
11111 AAAAAAA CA 91350
22222 BBBBBBB WA
33333 DDDDDDD CA 91350
22222 EEEEEEE WA
|
Required output
Code: |
EID Name State ZIPCODE
11111 AAAAAAA CA 91500
22222 BBBBBBB WA
33333 DDDDDDD CA 91500
22222 EEEEEEE WA |
This is a simple file with fixed block and 80 lrecl.
The State should be taken as reference. If the state is "CA" the ZIPCODE should be hardcoded to the new value. else it should be spaced out. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
The State should be taken as reference |
To what?
Quote: |
If the state is "CA" the ZIPCODE should be hardcoded to the new value |
You show a value in the output, but how would the process know which value to use? How is this new value provided to the process? What if there are 5 separate CA zipcodes in the input file? Even if the file has only 1 zipcode, what if it is not 91350?
You need to do a much more thorough job of describing the requirement. |
|
Back to top |
|
|
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
Hi,
I want to keep the example simple.
Lets consider that we are having only members from "CA" and "WA" in the input file. The output should have zipcode as "91350" for all "CA" members and spaces for all "WA" members.
These are the only two states and only two zipcodes. |
|
Back to top |
|
|
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
Sorry the output should have "91500" for all "CA" members and spaces for all "WA" members. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
This isn't tested, but should be close. . . .
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(nn,2,CH,EQ,C'CA'),OVERLAY=(nn:C'91500'),HIT=NEXT),
IFTHEN=(WHEN=(nn,2,CH,EQ,C'WA'),OVERLAY=(nn:C' '),HIT=NEXT)
|
You'll need to fill in the nn's as you didn't post the positions in the data. |
|
Back to top |
|
|
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
Thanks a lot Dick.
It works.
I tried searching in net for the information regarding this sort card but could not get it. Could you please let me a know a good reference for explanation on this sort card? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome - good to hear it works
The best reference is the Syncsort documentation which you can get for free from Syncsort if your organization is licensed.
d |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
nbalajibe,
Adding to what Dick suggested, you might not need the 'HIT=NEXT' if the conditions are mutually exclusive. |
|
Back to top |
|
|
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
Hi Arun,
Thanks for the sugestion.
Could you please let me know some materials for getting information on each of these key words? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
The best reference is the Syncsort documentation which you can get for free from Syncsort if your organization is licensed.
|
nbalajibe,
What you need to do has already been suggested here. As you are licensed to use Syncsort, you can Contact SyncSort support or send a PM to Alissa to get a manual. They'll be happy to assist you. |
|
Back to top |
|
|
|