IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Conditional formatting using SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nbalajibe
Warnings : 1

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 12, 2008 12:02 am
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Dec 12, 2008 12:43 am
Reply with quote

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

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 12, 2008 1:04 am
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Dec 12, 2008 1:22 am
Reply with quote

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

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 12, 2008 1:36 am
Reply with quote

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

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 12, 2008 1:37 am
Reply with quote

Sorry the output should have "91500" for all "CA" members and spaces for all "WA" members.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Dec 12, 2008 1:49 am
Reply with quote

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

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 12, 2008 3:06 am
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Dec 12, 2008 6:06 am
Reply with quote

You're welcome - good to hear it works icon_smile.gif

The best reference is the Syncsort documentation which you can get for free from Syncsort if your organization is licensed.

d
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 12, 2008 6:18 am
Reply with quote

nbalajibe,

Adding to what Dick suggested, you might not need the 'HIT=NEXT' if the conditions are mutually exclusive.
Back to top
View user's profile Send private message
nbalajibe
Warnings : 1

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 12, 2008 8:30 am
Reply with quote

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

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 12, 2008 8:48 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Syncsort help SYNCSORT 3
No new posts SYNCSORT-DB2 interface SYNCSORT 0
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need help on formatting a report DFSORT/ICETOOL 14
No new posts Rexx formatting CLIST & REXX 2
Search our Forums:

Back to Top