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: 2239
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: 2239
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: 2239
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 SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts 2 byte YEAR from Y'DATE2' field tecnokrat DFSORT/ICETOOL 2 Tue Feb 07, 2017 12:05 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am


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