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

Fillup default values in Space


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

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Jul 26, 2011 6:52 pm
Reply with quote

I have a requirement where i have to fill up default values for some columns.

INPUT RECORD
Code:

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6
****** ***************************** Top of Data ******************
000001 12/31/2010 22:00:00             +11111111.11111    ABCDEFGHI
000002 12/31/2010 22:00:00 178036.678  -12345678.12345 10 ABCDEFGHI


OUTPUT RECORD
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6
****** ***************************** Top of Data ******************
000001 12/31/2010 22:00:00          0  +11111111.11111  0 ABCDEFGHI
000002 12/31/2010 22:00:00 178036.678  -12345678.12345 10 ABCDEFGHI


The requirement is to put '0' (Zero) in the places 21-30 and 49-50 if there is a space in the specified positions. I want a generic step instead of coding all the positions and checking.

Is there something grouping we can do instead of coding separate IFTHEN statements as below? As there are many such columns to be checked.

Code:
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(21,10,CH,EQ,C' '),                 
           OVERLAY=(30:C'0')),               
    IFTHEN=(WHEN=(49,2,CH,EQ,C' '),                   
           OVERLAY=(50:C'0'))         



LRECL of the file is 60.

This file will be used to load a DB2 table using load utility and the column is defined as "NOT NULL" so we are supposed to put zeros as the values.

Also can you please let me know if there is any option in the DB2 load utility to achieve the same.

Using DB2 V8 Zos.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Jul 26, 2011 6:53 pm
Reply with quote

We have SYncSort in our shop.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jul 26, 2011 9:08 pm
Reply with quote

Hello,

Quote:
Is there something grouping we can do instead of coding separate IFTHEN statements as below?
Huh. . .?

If you want to check 8 separate "things" what good would "grouping" do?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Wed Jul 27, 2011 11:11 am
Reply with quote

Ok... Thanks for the reply... Also there is nothing in the Load utility to handle this?
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jul 27, 2011 12:03 pm
Reply with quote

Quote:
Code:
Code:
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(21,10,CH,EQ,C' '),                 
           OVERLAY=(30:C'0')),               
    IFTHEN=(WHEN=(49,2,CH,EQ,C' '),                   
           OVERLAY=(50:C'0'))           
 


Doesn't this just put a single '0' in the last byte of each field?

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

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Jul 27, 2011 12:10 pm
Reply with quote

Checking the last field position of the fields for a space will do the job too.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 27, 2011 2:19 pm
Reply with quote

Garry Carroll wrote:
Quote:
Code:
Code:
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(21,10,CH,EQ,C' '),                 
           OVERLAY=(30:C'0')),               
    IFTHEN=(WHEN=(49,2,CH,EQ,C' '),                   
           OVERLAY=(50:C'0'))           
 


Doesn't this just put a single '0' in the last byte of each field?

Garry.


Yes, however it then matches TS's example of output. I don't go for holding numerics in effectively "edited" fields, but it is what he says he wants (for now).
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Wed Jul 27, 2011 2:51 pm
Reply with quote

In order to validate more conditions for a single record, try HIT=NEXT parameter. The example which you showed does not bring you the specified output as it stops processing the validation once it encounters a true condition.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 27, 2011 3:29 pm
Reply with quote

PeterHolland wrote:
Checking the last field position of the fields for a space will do the job too.


Works in this sort of example. I always prefer to check the whole field in case it is happens to match on the one byte but the rest is garbled (I believe "junk values" is the contemporary description).

It's not just my day to be picky, I'm always picky :-)
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Jul 27, 2011 4:19 pm
Reply with quote

Bill,

pick someone else please icon_eek.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 27, 2011 4:46 pm
Reply with quote

Nobody else is being as useful as you are today, Peter (and I mean that genuinely, except about the "bubbles").
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Running a Job with the Default User ID JCL & VSAM 2
Search our Forums:

Back to Top