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
 

 

How to reformat same field differently basing on a key value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Aruna Gutti

New User


Joined: 14 Mar 2009
Posts: 3
Location: Boston, MA, USA

PostPosted: Tue Mar 17, 2009 8:19 pm    Post subject: How to reformat same field differently basing on a key value
Reply with quote

Hi,

This is my first post in this forum. So bear with me in case I missed anything. I checked the forum for a solution and couldn't come up with any hits.

I am trying to sort a VSAM file in to a CSV file using OUTREC feature. Some of the records have a field defined as characters and some have it as packed. So, how do I sort the file and reformat packed field properly.

Here is my basic sort control statement to create a CSV from VSAM:

SORT FIELDS=(5,5,CH,A)
RECORD TYPE=V
OUTREC FIELDS=(1,4,C'08,', (BEG RECORD)
5,2,C',', (GROUP NUM)
7,3,C',', (CODE )
10,1,C',', (AREA TYPE)
11,25,C',', (AREA1 )
26,25,C',') (AREA2 )

I am adding 08 as a starting field for the record.
If GROUP-NUM = 12 then the CODE field is coming as packed '9(5) Comp-3' otherwise it is coming as Char.

How to add that condition in the sort ?

Many Thanks,

Aruna.
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Tue Mar 17, 2009 8:37 pm    Post subject:
Reply with quote

Aruna,

Welcome to the forums. icon_smile.gif

Can you post here your input and output file attributes?
Back to top
View user's profile Send private message
Aruna Gutti

New User


Joined: 14 Mar 2009
Posts: 3
Location: Boston, MA, USA

PostPosted: Tue Mar 17, 2009 8:55 pm    Post subject:
Reply with quote

Hi Arun,

My Input is VSAM file with rec length 80and output file format is VB.

Here is JCL :

//SORTIN DD DSN=MC.VSAMLKUP,DISP=SHR
//SORTOUT DD DSN=LKUP.SEQ,
// DISP=(NEW,CATLG,DELETE),
// UNIT=DISK,
// SPACE=(0,(9,1),RLSE),
// DCB=(RECFM=VB,LRECL=70,BLKSIZE=0)


This is the Sysout listing :

SORTIN : RECFM=V ; LRECL= 80; CISIZE = 2048
OUTREC RECORD LENGTH = 68
SORTOUT : RECFM=VB ; LRECL= 70; BLKSIZE= 27998

Thanks,

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

Moderator


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

PostPosted: Tue Mar 17, 2009 11:26 pm    Post subject:
Reply with quote

Aruna Gutti,

I dont have access to mainframe and cant test this now. I'll show you a possible way of achieving the same. Try and post back in case of issues; somebody will be here to help. Good luck icon_smile.gif

Code:
 INREC FIELDS=(1,4,C'08,', (BEG RECORD)
               5,2,C',',   (GROUP NUM)
               7,3,C',',   (CODE )
              10,1,C',',   (AREA TYPE)
              11,25,C',',  (AREA1 )
              26,25,C',')  (AREA2 )
 SORT FIELDS=(5,5,CH,A) 
 RECORD TYPE=V
 OUTREC IFTHEN=(WHEN=(8,2,CH,EQ,C'12'),OVERLAY=(11:11,3,PD,EDIT=(TTT)))
Back to top
View user's profile Send private message
Aruna Gutti

New User


Joined: 14 Mar 2009
Posts: 3
Location: Boston, MA, USA

PostPosted: Wed Mar 18, 2009 12:08 am    Post subject: Reply to: How to reformat same field differently basing on a
Reply with quote

Hi Arun,

Wow! That is wonderful. It worked with a small change.

Instead of :

OUTREC IFTHEN=(WHEN=(8,2,CH,EQ,C'12'),OVERLAY=(11:11,3,PD,EDIT=(TTT)))

I Changed to :

OUTREC IFTHEN=(WHEN=(8,2,CH,EQ,C'12'),OVERLAY=(11:11,3,PD,EDIT=(TTTTT)))

as my out field is 5 bytes long.


Thanks a lot for your help,

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

Moderator


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

PostPosted: Wed Mar 18, 2009 1:52 am    Post subject:
Reply with quote

You're welcome. Glad that it's worked for you icon_smile.gif
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 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 How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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