Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] Converting YYMD (data) to YYYYMMDD (integer)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Converting YYMD (data) to YYYYMMDD (integer)
 Login/Join
 
Gold member
posted
Any thoughts on how to do this? I want to take 2016-01-12 (YYMD) to turn into 20160112 (integer).

I tried taking

DPART(DATE,YEAR) | DPART(DATE,MONTH) | DPART(DATE,DAY)

But that threw an error, expecting alpha fields.

Then I tried

EDIT(DPART(DATE,YEAR)) | EDIT(DPART(DATE,MONTH)) | EDIT(DPART(DATE,DAY))

And that just gave me jibberish. Any thoughts?

This message has been edited. Last edited by: FP Mod Chuck,


WebFocus 8.104
Windows 7 Entreprise, SP1
 
Posts: 82 | Location: Abbotsford BC | Registered: March 15, 2010Report This Post
Expert
posted Hide Post
Hi Max,
Did you try NEW_DATE/I8 = YOUR_YYMD_DATE_FIELD;
If that doesn't work, try the FPRINT function...
Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
quote:
NEW_DATE/I8 = YOUR_YYMD_DATE_FIELD;

Better,
NEW_DATE/I8YYMD = YOUR_YYMD_DATE_FIELD;
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
Good suggestion Tom.

Trying NEWDATE/I8 = DATEFIELD gave me a 5 digit number conversion, which wasn't I needed unfortunately.

FPRINT(DATEFILED, 'YYMD','I8')

gave the error:

1 FILE(S) LOADED
0 ERROR AT OR NEAR LINE 10 IN PROCEDURE TEST_TRN58FOCEXEC *
(FOC36355) INVALID TYPE OF ARGUMENT #3 FOR USER FUNCTION FPRINT
(FOC101) ERROR IN DEFINE IN MASTER FILE: TABLE_NAME
BYPASSING TO END OF COMMAND

So then I just got fancy and over-engineered the function.

EDIT(SUBSTV(10, FPRINT(START_DATE, 'YYMD', 'A10'),1,4,'A4') | SUBSTV(10, FPRINT(START_DATE, 'YYMD', 'A10'),6,7,'A2') | SUBSTV(10, FPRINT(START_DATE, 'YYMD', 'A10'),9,10,'A2'))

Maybe more work than necessary, but gets the job done. Thanks for the help!


WebFocus 8.104
Windows 7 Entreprise, SP1
 
Posts: 82 | Location: Abbotsford BC | Registered: March 15, 2010Report This Post
Gold member
posted Hide Post
quote:
Originally posted by j.gross:
quote:
NEW_DATE/I8 = YOUR_YYMD_DATE_FIELD;

Better,
NEW_DATE/I8YYMD = YOUR_YYMD_DATE_FIELD;


That keeps the "/" which I want to get rid of.


WebFocus 8.104
Windows 7 Entreprise, SP1
 
Posts: 82 | Location: Abbotsford BC | Registered: March 15, 2010Report This Post
Expert
posted Hide Post
quote:
That keeps the "/" which I want to get rid of.


That is a formatted integer.

Just assign result to an I8 field


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Need to use I8YYMD

 TABLE FILE systable
 PRINT NAME NOPRINT
 COMPUTE SOMEDAY/YYMD    = 20131211;
 COMPUTE SOMEDAY2/I8YYMD = SOMEDAY;
 COMPUTE SOMEDAY_I8/I8   = SOMEDAY2;
 WHERE RECORDLIMIT IS 1
 END  


WebFOCUS 8.2.06
 
Posts: 210 | Location: Sterling Heights, Michigan | Registered: October 19, 2010Report This Post
Master
posted Hide Post
Try using the DATECVT function:
https://webfocusinfocenter.inf...r/source/datecvt.htm

 INT_DATE/I8 = DATECVT ( YYMD_DATE, 'YYMD', 'I8YYMD'); 


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] Converting YYMD (data) to YYYYMMDD (integer)

Copyright © 1996-2020 Information Builders