|
View previous topic :: View next topic
|
| Author |
Message |
karthikr44
Active User

Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
Hi,
I have two date fields in the format CCYYMMDD
02 DB-DT-QTR-BEGIN PIC 9(5) COMP-3.
02 DB-DT-QTR-END PIC 9(5) COMP-3.
And i have another date field in the format YYMMDD
02 AV-DT-CLM-PRCH PIC 9(6) COMP-3.
My requirement is to add century to the field AV-DT-CLM-PRCH and detemine if that date is within the dates DB-DT-QTR-BEGIN and DB-DT-QTR-END.
If condition is satisfied then write the record out. I have no idea about date formats. Any one help me.
Thanks in advance
R KARTHIK |
|
| Back to top |
|
 |
karthikr44
Active User

Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
Sorry i forgot to specify the field position,
Viewed in File master,
I file
DB DT DB DT
QTR BEGIN QTR END
P 3 P 3
27------- 30-----
II file
AV DT
CLM PRCH
P 4
125-------- |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| My requirement is to add century to the field AV-DT-CLM-PRCH and detemine if that date is within the dates DB-DT-QTR-BEGIN and DB-DT-QTR-END. |
What century value you would like to add to the second date field - AV-DT-CLM-PRCH?
| Quote: |
| If condition is satisfied then write the record out |
What are the fields to be written to the output and from which files? Also Input LRECL/RECFM.. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
karthikr44,
The date format in your File-1 is CCYYMMDD which in packed decimal would require 5 bytes. But your copybook shows only 5 numeric digits which requires only 3 bytes which agrees with your "File Master". Can you post a few sample records from your actual files. |
|
| Back to top |
|
 |
karthikr44
Active User

Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
HI arcvns,
When i tried to open the I file in File master it displaying the date as follows.
| Code: |
DB DT DB DT
QTR BEGIN QTR END
P 3 P 3
27------- 30-----
X'031F08' X'001F+
010 010
3F8 0F8
------------------
|
But my team lead now said that the above fields are in julian format (eg: 08215) and convert to CCYYMMDD format.
Then the field AV-DT-CLM-PRCH in second file is in YYMMDD format and convert to CCYYMMDD format.
I file:
RECFM:FB
LRECL: 3200
II file:
RECFM:FB
LRECL: 200
And then if the condition satisfied write the output from second file(entire LRECL).
Thanks in advance
R KARTHIK |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| How many records do you have in both the files? Do you have a key to match? |
|
| Back to top |
|
 |
karthikr44
Active User

Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
Hi arcvns,
I File which contains the fields DB-DT-QTR-BEGIN, DB-DT-QTR-END has only one record.
II file which contains the field AV-DT-CLM-PRCH has many records.
And the condition is AV-DT-CLM-PRCH should be within DB-DT-QTR-BEGIN and DB-DT-QTR-END.
Regards
R KARTHIK |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Karthik,
You can use the below Syncsort job to achieve this. I have assumed the Century window 1950-2049. You can modify it as per your needs.
| Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=&&C1,DISP=(MOD,PASS)
//SORTIN DD DSN= Date file---FB/3200
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(X,27,3,X,30,3)),
IFTHEN=(WHEN=(2,1,CH,GT,X'49'),OVERLAY=(1:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(2,1,CH,LE,X'49'),OVERLAY=(1:X'01'),HIT=NEXT),
IFTHEN=(WHEN=(6,1,CH,GT,X'49'),OVERLAY=(5:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(6,1,CH,LE,X'49'),OVERLAY=(5:X'01'),HIT=NEXT)
OUTFIL BUILD=(C'BEG,',1,4,DT1,80:X,/,
C'END,',5,4,DT1,80:X)
//STEP02 EXEC PGM=SORT,PARM='CENTWIN=1950'
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&C1,DISP=(OLD,PASS)
//SORTIN DD DSN= Input file ---FB/200
//SORTOUT DD DSN= Output file ---FB/200
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(201:125,2,Y2P,126,2,PD0,M11,127,2,PD0,M11)
OUTFIL INCLUDE=(201,8,ZD,GE,BEG,AND,201,8,ZD,LE,END),BUILD=(1,200) |
|
|
| Back to top |
|
 |
karthikr44
Active User

Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
Hi Arun,
Thnx for ur solution. But i am getting SOC7 abend.
I/p data:
| Code: |
DB DT
QTR BEGIN
P 3
27-------
X'274F08'
240
7F8
|
DUMP:
ADDRESS 00000000 LENGTH 00000000 (DECIMAL ) INVALID LENGTH
JOB: JCLSORT STEP: STEP01 PROGRAM: QKQMAIN
CAPD112W SYMBOLIC INFORMATION NOT FOUND FOR PROGRAM "QKQMAIN ".
ABENDING INSTRUCTION
F871 F0E2 F0EC ZAP ZERO AND ADD
OPERAND: R15!+E2
VALUE: 0000000000000000 <-- NOT NUMERIC
OPERAND: R15!+EC
VALUE: 4F08 <-- NOT NUMERIC
INTERRUPT OCCURRED AT ADDRESS 80023326
ENTRY POINT ADDRESS IS 00007130 AT OFFSET +000000 IN PROGRAM QKQMAIN
And one small update, the first file LRECL is 3208 and not 3200. I think this does not produce the S0C7 abend.
Please suggest me how to solve this abend,
Thanks
R KARTHIK |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Karthik,
The data you have in your input file does n't seem to be a valid COMP-3 data. Correct the data and try again. |
|
| Back to top |
|
 |
karthikr44
Active User

Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
HI,
That file I is production file. It wont be wrong. Also i tried with many files and all went to S0C7 abend.
Thanks
R KARTHIK |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| That file I is production file. It wont be wrong |
I m not saying that your production file is wrong. The way you interpret might be wrong. A packed decimal field will always store the sign in the last half-byte. And your 3 byte packed date looks like this which is not a valid COMP-3 field. You need to be clear on what data are you processing with.
| Code: |
DB DT
QTR BEGIN
P 3
27-------
X'274F08'
240
7F8 |
|
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Open your file in view/browse (not file master) and scroll right to this data position (also use COLS to show the positions in the record). Post this bit of data in hex (HEX ON, copy/paste to the reply you will be creating, and use the "Code" tag to make the data more readable as well as preserve alignment) - including the COL info. Use the Preview to see your reply as it will appear to the forum and when you are satisfied with how your post appears, Submit.
As has been mentioned, the data posted is not valid packed-decimal (comp-3) data.
The following is similar to how your data should be posted. The 2 numbers are valid comp-3 values for 08215 and 21508. I used a C sign, but an F sign could be valid as well.
| Code: |
--3----+----4-
--------------
* &ð
44025444258444
0081C00010C000 |
It sounds like the displacement used in the sort control is not where the packed-decimal data is located. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
It sounds like the displacement used in the sort control is not where the packed-decimal data is located.
|
Karthik,
I had given the control statements based on positions and offset mentioned by you which might be wrong as they dont have valid COMP-3 data. Check your files and find out the correct field positions. |
|
| Back to top |
|
 |
karthikr44
Active User

Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
Hi,
Thnx for all ur replies. Here i am providing the required info.
| Code: |
2----+----3
**********
9P3 | |
FDF02402402
97387F87F84
-----------
|
Here,
DB-DT-QTR-BEGIN - (24,3)
DB-DT-QTR-END - (27,3)
In copybook they defined this field as,
02 DB-DT-QTR-BEGIN PIC 9(5) COMP-3.
02 DB-DT-QTR-END PIC 9(5) COMP-3.
And it is in the format YYDDD.
Regards
R KARTHIK |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
Here,
DB-DT-QTR-BEGIN - (24,3)
DB-DT-QTR-END - (27,3) |
As per the data you posted, the positions seem to be DB-DT-QTR-BEGIN - (23,3) and DB-DT-QTR-END - (26,3) .  |
|
| Back to top |
|
 |
karthikr44
Active User

Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
HI arcvns,
U pointed out correctly. Now i am not getting S0C7 abend.
Thnx..
But one more help, will u please explain the following lines in short,
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(X,27,3,X,30,3)),
IFTHEN=(WHEN=(2,1,CH,GT,X'49'),OVERLAY=(1:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(2,1,CH,LE,X'49'),OVERLAY=(1:X'01'),HIT=NEXT),
IFTHEN=(WHEN=(6,1,CH,GT,X'49'),OVERLAY=(5:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(6,1,CH,LE,X'49'),OVERLAY=(5:X'01'),HIT=NEXT) |
Thanks in advance,
R KARTHIK |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hi,
Hopefully you are available with the manuals, if not request Alissa to send the latest documentation to you, she is SyncSort representative & Moderator of JCL part on this site.
1. OPTION COPY: Causes XXxxSORT to copy a SORTIN data set or inserted records to the output data sets. ( unless all records are disposed of by an E35 exit).
2. IFTHEN clauses: Reformat different records in different ways by specifying how build or overlay items are applied to records that meet given criteria. IFTHEN clauses let you use sophisticated conditional logic to choose how different record types are reformatted.
2. BUILD: Reformat each record by specifying all of its items one by one. Build gives you complete control over the items you want in your reformatted records and the order in which they appear. You can delete, rearrange and insert fields and constants.
3. OVERLAY: Reformat each record by specifying just the items that overlay specific columns. Overlay lets you change specific existing columns without affecting the entire record.
OVERLAY is used to overlay specific bytes - you can't use it to insert characters before other fields. For that you must use BUILD which builds the record item by item.
4. If you have multiple fields to inspect in the same record, you must use the HIT=NEXT option. |
|
| Back to top |
|
 |
karthikr44
Active User

Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
HI Anuj,
Thnx for ur reply and explaining statements.
I did not mentioned clearly in previous post. Actually i want what logic
he try to implement using that lines.
Thanks
R KARTHIK |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| Now i am not getting S0C7 abend. |
Karthik,
Good that you're not getting S0C7. Is it giving the expected output? . So what was the issue- "correct production file" or the layout? |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|