Have you been memorizing field names or relying on F4 prompting?
When creating file joins using interactive SQL (STRSQL), it's sometimes difficult to remember the field names that you want to join. I typically don't memorize field names and totally rely on the F4 prompting to get the names from the "SELECT fields" line.
Unfortunately, sometimes I can't use this method because I have not yet created a valid "FROM files" clause. So I'm stuck with the "CUSTOMER inner join SALES" on the "FROM files" line and no field names to complete the join clause. Creating a second session and performing a DSPFFD command would solve the problem, but here's a quicker, easier solution.
On the "FROM files" line, enter your file-level joins (CUSTOMER left join SALES). Then, enter an "absolute positive" field-level join criteria like ON 1=1.
FROM files . . . . . . . . . CUSTOMER inner join SALES
on 1=1
Since the files are now correctly joined, you can tab down to "SELECT fields" and press F4 to prompt the file field names. Select the fields using odd numbers on the first file fields and even numbers on the second file fields.
Seq Field File TEST
1 CUCNBR CUSTOMER Customer Number
3 CUCRGN CUSTOMER Customer Region
CUADD1 CUSTOMER Customer Address 1
CUADD2 CUSTOMER Customer Address 2
CUCITY CUSTOMER Customer City
2 SLCUNO SALES Customer Number
4 SLCURG SALES Customer Region
SLORNO SALES Order Number
SLORTY SALES Order Type
SLORDT SALES Order Date
Press Enter. Your selected fields will return in the order that matches.
CUSTOMER.CUCNBR, SALES.SLCUNO, CUSTOMER.CUCRGN,
SALES.SLCURG
Cut and paste the fields from the "SELECT fields" lines to the "FROM files" lines and format by replacing the comma with equal signs (=), and's, and or's.
FROM files . . . . . . . . . CUSTOMER inner join SALES
on CUSTOMER.F1FLD1 = SALES.F2FLD1 and
CUSTOMER.F1FLD2 = SALES.F2FLD2
SELECT fields . . . . . . . *
Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:
LATEST COMMENTS
MC Press Online