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

Syncsort - NULL in Integer field checking


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Thu Oct 06, 2016 6:47 am
Reply with quote

I am unloading few columns from my DB2 table, and running through SYNCSORT.

Each column is '|' delimited. The second column, shows following definition in DB2 table - Integer NULLIF (196) = '?'. Whats the best way to convert the column to ZD format, and replace all null fields with spaces. I tried searching the forum with vain, and going through manual. If someone could point me exactly how can I do this would appreciate it.

In DB2 statement, this will be equivalent of CHAR(COALESCE(<fieldname>,' ')) function.

Code:
*****************
|2013-11-28| ::è|
4FFFF6FF6FF400054
F2013011028F0234F
----------------
|2013-11-28|  õ:|
4FFFF6FF6FF400C14
F2013011028F00FFF
----------------
|2013-12-12| ::,|
4FFFF6FF6FF400164
F2013012012F025BF
----------------
|2013-12-12| :³¾|
4FFFF6FF6FF400FB4
F2013012012F01A9F
----------------
|2013-12-12| ::x|
4FFFF6FF6FF4000A4
F2013012012F0227F


Code:

162:182,10,C'|',
173:192,BI,ZD,LENGTH=9,C'|'


After going through manual, I tried 173:192,4,C'|'
Back to top
View user's profile Send private message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Thu Oct 06, 2016 7:08 am
Reply with quote

I think I didn't put question well, I understand I can do

Code:
173:192,4,BI,EDIT=(TTTTTTTTTT),C'|')

to convert from BI to ZD format. However, how do we check for a null character in a specific position, do I need to do INREC Parsing or something ?
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: Thu Oct 06, 2016 10:24 am
Reply with quote

There is no "null character". If a column can be NULL, there will be a separate indicator for each row to tell you whether the value is NULL or not, and you use that. If you have not used that explicitly or implicitly in the preparation of your data, then you need to do that.
Back to top
View user's profile Send private message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Thu Oct 06, 2016 10:51 am
Reply with quote

Bill Woodger wrote:
There is no "null character". If a column can be NULL, there will be a separate indicator for each row to tell you whether the value is NULL or not, and you use that. If you have not used that explicitly or implicitly in the preparation of your data, then you need to do that.


You are right. I havent been able to keep my head straight, and not sure what was i thinking when i wrote the original query..

Say:

EMP_IDNUM SMALLINT - position 1-3
EMP_NUM INTEGER (IF NULL POS(4) = '?') [ records with no emp_num suggests "contractor"/"consultant"] position 4-7
EMP_NAME VARCHAR position 8-50
EMP_AMOUNT DECIMAL(11,2) position 50 onwards

Varchar normally has first 2 bytes of the particular field to indicate the type of data. Ifnull for an integer would have last byte turned on for null character.

If you can let me know, if it would be INREC and PARSE that could achieve this, it would be helpful.
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: Thu Oct 06, 2016 12:29 pm
Reply with quote

Gernerally, if the data is variably-located, you would use PARSE. If in fixed locations, of fixed size, just define the fields (start-positio,lenght - without data-type in a BUILD/OVERLAY/PUSH (generally) and with data-type for an IFTHEN.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
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 Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top