Generate SQL with variable length fields from CA 2E

Transcription

Generate SQL with variable length fields from CA 2E
Generate SQL with variable length fields from
CA 2E
Eamonn Foley
Sessions B(2e Track)
FOR INFORMATION PURPOSES ONLY
Terms of this presentation
This presentation was based on current information and resource allocations as of April 2013 and is subject to change or
withdrawal by CA at any time without notice. Notwithstanding anything in this presentation to the contrary, this presentation
shall not serve to (i) affect the rights and/or obligations of CA or its licensees under any existing or future written license
agreement or services agreement relating to any CA software product; or (ii) amend any product documentation or
specifications for any CA software product. The development, release and timing of any features or functionality described
in this presentation remain at CA’s sole discretion. Notwithstanding anything in this presentation to the contrary, upon the
general availability of any future CA product release referenced in this presentation, CA will make such release available (i)
for sale to new licensees of such product; and (ii) to existing licensees of such product on a when and if-available basis as part of
CA maintenance and support, and in the form of a regularly scheduled major product release. Such releases may be made
available to current licensees of such product who are current subscribers to CA maintenance and support on a when and
if-available basis. In the event of a conflict between the terms of this paragraph and any other information contained in this
presentation, the terms of this paragraph shall govern.
Certain information in this presentation may outline CA’s general product direction. All information in this presentation is for
your informational purposes only and may not be incorporated into any contract. CA assumes no responsibility for the accuracy
or completeness of the information. To the extent permitted by applicable law, CA provides this presentation “as is” without
warranty of any kind, including without limitation, any implied warranties or merchantability, fitness for a particular purpose, or
non-infringement. In no event will CA be liable for any loss or damage, direct or indirect, from the use of this document,
including, without limitation, lost profits, lost investment, business interruption, goodwill, or lost data, even if CA is expressly
advised in advance of the possibility of such damages. CA confidential and proprietary. No unauthorized copying or distribution
permitted.
Abstract
Eamonn Foley
The Warranty Group, Senior Programmer/Analyst
This presentation shows how to setup 2e to generate SQL with
variable length fields (VARCHAR and VARGRAPH) based fields that
didn’t require developers to add any additional code. This
facilitates using external tools(WebQuery) or external systems
that are not familiar with the ‘O’ open data type.
3
Copyright © 2013 CA. All rights reserved.
Agenda
 Business Background
 Parsing the source code
– SQL
– RPGLE
 Coding
– New field types
– Challenges interfacing with RPG
 Q/A
Business Background
 Project – International Application Supporting Native
Languages
– Needed to support interfaces with native Iseries and Windows
applications
 Interface was handled via external files for each application
 Needed to support double-byte character sets (ex. Chinese)
– Needed to support external reporting tools (IBM WebQuery)
Business Background
cont.
 Design Challenges
– Custom native code required to support each interface
– Limited support for external reporting
 Required to convert back to SQL tables to report
 Epiphany
– 2e Chicago Conference
– Crispen Bates DDS to DDL Presentation
– 2e Pre and Post Compiler exit program
– RPGLE will generate the code correctly (mostly)
– Most important, it wouldn’t require us to maintain custom user source
Parsing the Source Code
SQL
 Getting Started
– Retrieve 2e field details (Field Name, Type, Size)
Parsing the Source Code
SQL cont.
Parsing the Source Code
SQL cont.
Parsing the Source Code
SQL cont.
Parsing the Source Code
SQL cont.
Parsing the Source Code
SQL cont.
Parsing the Source Code
RPGLE
 Requires RPGLE
 Replace MOVEL expression
– EVAL expression
 Need to track numeric fields
Parsing the Source Code
RPGLE cont.
Parsing the Source Code
RPGLE cont.
Parsing the Source Code
RPGLE cont.
Parsing the Source Code
RPGLE cont.
Parsing the Source Code
RPGLE cont.
Parsing the Source Code
RPGLE cont.
Parsing the Source Code
RPGLE cont.
Parsing the Source Code
RPGLE cont.
Parsing the Source Code
RPGLE cont.
Coding
Defining the fields
 Variable Character Fields
– Create New Data Type VCH
– Looks and acts like a standard text field.
– Field is defined to be 2 bytes larger then the maximum size.
 Variable Graphic Fields
– Uses the existing IGC field.
– Field is sized and acts the same as the IGC field.
Coding
Challenges
 Calling from other programs
– Variable character and Text are not the same data types.
 Displaying on a screen
– Like IGC, variable character has extra byte.
– To display fields properly, both client access and job CCSID have to be
correct for the data
Summary
 Variable length fields (character and graphic)
 Use of 2e pre/post compiler
 No user source for developers
Q&A
Sample Slides
Title – Title Case, Calibri 26 pt Bold
2 Line Max
Highlighted text if needed – sentence case
 Bullet 1, Calibri regular 24 pt – sentence case
– Sub-bullet, Calibri regular 20 pt – sentence case
 Sub-sub-Bullet, Calibri regular 18 pt
Title – Title Case, Calibri 26 pt Bold
Subtitle – sentence case, Calibri 20 pt bold
Highlighted text if needed – sentence case
 Bullet 1, Calibri regular 24 pt – sentence case
– Sub-bullet, Calibri regular 20 pt – sentence case
 Sub-sub-Bullet, Calibri regular 18 pt
Title – Title Case, Calibri 26 pt Bold
2 Line Max
 Bullet 1, Calibri regular 24 pt - sentence case
– Sub-bullet, Calibri regular 20 pt – sentence case
 Sub-sub-Bullet, Calibri regular 18 pt
HIGH LEVEL TOPIC / SUBJECT - UPPER CASE, CALIBRI 20 PT BOLD
Subtitle – sentence case, Calibri 20 pt bold
 Bullet 1, Calibri regular 24 pt – sentence case
– Sub-bullet, Calibri regular 20 pt – sentence case
 Sub-sub-Bullet, Calibri regular 18 pt
Sample Table Slide
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
– Magna consectet at
lor ipsustie
modolore coreriu
scilit vel utatueros
nulla feugait
– Magna consectet at
lor ipsustie
modolore coreriu
scilit vel utatueros
nulla feugait
– Magna consectet at
lor ipsustie
modolore coreriu
scilit vel utatueros
nulla feugait
– Magna consectet at
lor ipsustie
modolore coreriu
scilit vel utatueros
nulla feugait
– Magna consectet at
lor ipsustie
modolore coreriu
scilit vel utatueros
nulla feugait
– Magna consectet at
lor ipsustie
modolore coreriu
scilit vel utatueros
nulla feugait
– Magna consectet at
lor ipsustie
modolore
– Magna consectet at
lor ipsustie
modolore coreriu
scilit
– Magna consectet at
lor ipsustie
modolore coreriu
scilit
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
SAMPLE BAR CHART SLIDE
Series 3
20
0
Category 1
Category 2
Category 3
Category 4
Above average
10
10
Average
6
15
12
29
32
12
5
6
Below average
23
12
Item 1
Use the footnote layout if you need to source.
Item 2
Item 3
Item 4
Recommended Slides
SAMPLE PIE CHART
2013