MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to place a space before and after a delimited record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
sree_sen
Beginner


Joined: 24 Jun 2005
Posts: 10
Topics: 3

PostPosted: Tue Jul 05, 2005 2:54 am    Post subject: How to place a space before and after a delimited record Reply with quote

Hi,

The records to my i/p file are pre-formatted as below -
Code:

R1    R2   R3    R4                R5
---------------------------------------------------------(read file)
A  | AT | 2005| 1 |2005-07-04-06.00.02.198811|
A  | XZ | 2005| 1 |2005-07-04-06.00.02.198811|


I want the records in my o/p file to appear as -
Code:

R1   R2    R3    R4                 R5
--------------------------------------------------------(read file)
A  | AT | 2005| 1 | 2005-07-04-06.00.02.198811 |
A  | XZ | 2005| 1 | 2005-07-04-06.00.02.198811 |

i.e i want to place a space only before the record R5 and after R5 , and the other records will be as-is.

Please suggest me a way to achieve this.

Thanks in advance,
_________________
-Sree
Back to top
View user's profile Send private message
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Tue Jul 05, 2005 6:01 am    Post subject: Reply with quote

Sree,

The below JCL will give u the desired results. I am assuming a FB file of record length 80.

Code:

//STEP01 EXEC PGM=SORT                                                 
//SYSOUT DD SYSOUT=*                                     
//SORTIN  DD *                                                         
A | AT | 2005| 1 |2005-07-04-06.00.02.198811|                           
A | XZ | 2005| 1 |2005-07-04-06.00.02.198811|                           
/*                                                                     
//SORTOUT DD SYSOUT=*                                                   
//SYSIN DD *                                                           
   SORT FIELDS=COPY                                                     
   OUTREC FIELDS=(1,18,X,19,26,X,45,1,32X)                               
/*

Thanks,
Ram
Back to top
View user's profile Send private message
sree_sen
Beginner


Joined: 24 Jun 2005
Posts: 10
Topics: 3

PostPosted: Tue Jul 05, 2005 6:08 am    Post subject: Reply with quote

Thanks a lot, Ram, Its working perfect...
_________________
-Sree
Back to top
View user's profile Send private message
sree_sen
Beginner


Joined: 24 Jun 2005
Posts: 10
Topics: 3

PostPosted: Tue Jul 05, 2005 8:54 am    Post subject: Reply with quote

Ram,

What if my file is a VB one? The '|' delimiter and other records are in the same columns though.
Basically this problem I am facing while migrating from the Platinum Unload utility to DB2 High performance utility called INZUTILB- in the platinum utility, we were using the following -

FASTUNLOAD
LOAD-CONTROL NONE
OUTPUT-FORMAT COMMA-DELIMITED
SQL-ACCESS ONLY
COMMA X'4F'
QUOTE X'40'

before the Select command. I have coded my DB2 card as

UNLOAD TABLESPACE
Select .......
......
....
....
OUTDDN ( SYSREC00 )
FORMAT DELIMITED SEP '|' DELIM ' ' ;

This implies my Platinum card interprets Character as Spaces and places a space for the timestamp field which is 26 bytes. But my DB2 card cannot do such.


Any help in this regard would be appreciated.
Thanks,
_________________
-Sree
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Jul 05, 2005 9:09 am    Post subject: Reply with quote

Sree_sen,

If your input file is vb then you need to consider the rdw. The following JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR                                                   
//SORTOUT  DD SYSOUT=*                                                   
//SYSIN DD *                                                           
   SORT FIELDS=COPY                                                     
   OUTREC FIELDS=(1,4,         $ RDW
                  5,18,        $ FIRST 18 BYTES
                  X,           $ SPACE 
                  23,26,       $ TIME STAMP
                  X,           $ SPACE   
                  49)          $ REST OF THE DATA 
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sree_sen
Beginner


Joined: 24 Jun 2005
Posts: 10
Topics: 3

PostPosted: Tue Jul 05, 2005 9:33 am    Post subject: Reply with quote

Hi Kolusu,

I tried the snippet u provided -
I am getting the following as my o/p -

Code:

 A  | AT | 2005| 1  |2005-07-04-06.00.02.1988 11|
 A  | XZ | 2005| 1  |2005-07-04-06.00.02.1988 11|


whereas, it should be something like this -

Code:

A  | AT | 2005| 1 | 2005-07-04-06.00.02.198811 |
A  | XZ | 2005| 1 | 2005-07-04-06.00.02.198811 |

The spaces would come between the | and the TS field, instead of after the 1 and the | as it is taking now.
_________________
-Sree
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Jul 05, 2005 9:42 am    Post subject: Reply with quote

Sree_sen,

What is the exact position of the timestamp field ?. As per ram's example the timestamp field starts at 19. But looks like your timestamp field actually starts at pos 20. Since it is a vb file we need to add the RDW.

so try the following control cards.

Code:

//SYSIN DD *                                                           
   SORT FIELDS=COPY                                                     
   OUTREC FIELDS=(1,4,         $ RDW
                  5,19,        $ FIRST 19 BYTES
                  X,           $ SPACE 
                  24,26,       $ TIME STAMP
                  X,           $ SPACE   
                  50)          $ REST OF THE DATA 
/*


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sree_sen
Beginner


Joined: 24 Jun 2005
Posts: 10
Topics: 3

PostPosted: Tue Jul 05, 2005 10:26 am    Post subject: Reply with quote

Hi Kolusu,

Thanks, it worked finally, but with a slight modification. Here is my snippet -

//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,4,5,20,X,25,26,X,51)
/*
//*

The TS field would be at 21st position- so I just added ur position param by 1 byte and it worked.

Thanks a lot, once again, Ram and Kolusu.
_________________
-Sree
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group