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
 

 

Syncsort - NULL in Integer field checking

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
nartcr

New User


Joined: 06 Jun 2007
Posts: 78
Location: anada

PostPosted: Thu Oct 06, 2016 6:47 am    Post subject: Syncsort - NULL in Integer field checking
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: 78
Location: anada

PostPosted: Thu Oct 06, 2016 7:08 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7279

PostPosted: Thu Oct 06, 2016 10:24 am    Post subject: Reply to: Syncsort - NULL in Integer field checking
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: 78
Location: anada

PostPosted: Thu Oct 06, 2016 10:51 am    Post subject: Re: Reply to: Syncsort - NULL in Integer field checking
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7279

PostPosted: Thu Oct 06, 2016 12:29 pm    Post subject: Reply to: Syncsort - NULL in Integer field checking
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm
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
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am


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