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: 73
Location: Chicago

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: 73
Location: Chicago

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: 7228

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: 73
Location: Chicago

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: 7228

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 Performing arithmetic on input field zh_lad DFSORT/ICETOOL 1 Tue Dec 06, 2016 8:04 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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