Hi ,
This could be complex dfsort even though the subject looks simple .Need help.
File format : VB
Format of data :HEX
Length 600
Criteria : Check in vb file
1.if record value in position 19 to 21 is equal to x'22003a'
2.and if for position 48th to 50th the date which is in x'YYMMDD' is lesser than current date (i.e any previous day's date).if it is any of previous day's date ,then
Action:
1.Replace with current date in yymmdd format(all hex format) in same position(48th to 50th)
2.Replace the position of 22 to 23 with hex value x'0087'
3.Replace the Position 30th to 31st as x'0001' for first replacement situation.Upon second record found(second replacement situation) with above criteria the same Replace the Position 30th to 31st as x'0002' .Upon third record found(Third replacement situation with above critera the same Replace the Position 30th to 31st as x'0003' .....and so on for every replacement.
Output file:1
a.should be the VB file with same length 600 and should be in HEX format.(final file after above replacement)
Output file :2
a.Position 1 -4 (Input file value)/Position 1-4(Outputfile1 value)
b.Pos_22 To Pos_23 (Input file value)/Pos_22 To Pos_23 (Output file1 value)
c.Pos_30 To Pos_31 (Input file value)/Pos_30 To Pos_31 (Output file1 value)
d.Pos_48 To Pos_50 (Input file value)/Pos_48 To Pos_50 (Output file1 value)
@Joerg.Findeisen
Problem here is current date(ddmmyy) should be determined dynamically during batch cycle execution.And then it should compare that with what is present in the file . i am unable to pass the current date as symbolics like it is mentioned below as it is static constant.
Kindly suggest me a piece of dfsprt which will help me in overlaying the values based on date comparison dynamically.You have been very helpful in my past threads as well .Thanks for that first of all .
Command ===> Scroll ===> CSR
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7
****** ***************************** Top of Data ****************************
000001 1537159 t 0 g 6lpl 9 &d 0 0 &d ç 0 ã 0 1 0
FFFFFFF000A00F0301203083F999300303F3583F3F358332113133243F32343F3F3F00
15371590003010080420A07A6373A01A1A9A04A0A0A04AA007A18A08A0A3A6A0A1A000
-----------------------------------------------------------------------------
000002 1537159 t 0 qËáÈ 4Á àr 4 3 0
FFFFFFF000A00F0100203000000974703F63493F3F3F22444444444444444444444444
153715900030200C0726A00000583544A45A49A4A3A02C000000000000000000000000
-----------------------------------------------------------------------------
But original problem remains the same for me as i donot know how do i pass the dynamically determined current batch date and use the symbolic how you used in your original icetool jcl.Your help will be much appreciated .thank you
Thank you Joerg.Findeisen!looks this part worked for me .But as per my original request/ question (part2 ),is there any possibility i could bring the old and new value in new output file 2 as mentioned below .
Output file :2
a.Position 1 -4 (Input file value)/Position 1-4(Outputfile1 value)
b.Pos_22 To Pos_23 (Input file value)/Pos_22 To Pos_23 (Output file1 value)
c.Pos_30 To Pos_31 (Input file value)/Pos_30 To Pos_31 (Output file1 value)
d.Pos_48 To Pos_50 (Input file value)/Pos_48 To Pos_50 (Output file1 value)
Output file 2 format:(8 COLUMNS)
Oldvalue New_value Old_value new_value Old_value new_value Old_value new_value
current output in file 1
Code:
Command ===> Scroll ===> CSR
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 1537159 t 0 g 6lpl 9 &d 0 0 &d ç 0 ã 0 1 0
FFFFFFF000A00F0301203083F999300303F3583F3F358332113133243F32343F3F3F0000
15371590003010080420A07A6373A01A1A9A04A0A0A04AA007A18A08A0A3A6A0A1A00000
------------------------------------------------------------------------------
000002 1537159 t 0 qËáÈ 4Á àr 4 3 0
Joined: 15 Aug 2015 Posts: 1222 Location: Bamberg, Germany
It is not overly complicated to temporary clone the record before it's getting modified in the INREC. After processing any changes you just copy the fields you need in the OUTFIL section for either OUTPUT1 or OUTPUT2.
Code:
//SORTOUT DD DUMMY SYSOUT=*
//OUTPUT1 DD SYSOUT=*
//OUTPUT2 DD SYSOUT=*
//SYSIN DD *
OPTION COPY,VLSCMP
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5,596,5,596)),
IFTHEN=(WHEN=(23,3,BI,EQ,X'22003A',AND,52,3,BI,LT,Today),
OVERLAY=(26:X'0087',34:SEQNUM,2,BI,52:Today))
OUTFIL FNAMES=(OUTPUT1),
REMOVECC,VLTRIM=C' ',
BUILD=(1,4,5,596) * RDW and the (maybe) modified record (VB;600)
OUTFIL FNAMES=(OUTPUT2),
REMOVECC,VLTRIM=C' ',
* Build whatever is needed from RDW + modified record, followed by..
* another 596 bytes of the Original record. See INREC IFTHEN INIT
BUILD=(1,4,5,4,601,4,..) * RDW, new_val(1,4), old_val(1,4) here
END
/*
Need some help from you here .Tried using RDW value,it worked for output1 file .But for outputfile2 issue with when=init/ RDW usage of value .eventhough its not complicated as iam a beginner to ICETOOL ,need some help here in making the file in readable format and also usage of rdw.I am learning from your every post on understanding icetool usage in my work environment..thanks for that.
Few points
1.I do not want to write all the records of the file only replaced ones .For eg : if there are total 72 records and if only 3 records are replaced i would need only those selected fields only from those 3 records only (before and after values)
2.Entire length of records not required to be written to output .only selected fields from before and after change
3.final Output2 cannot be in hex format ,it should be in readable format like a report
a.Position 1 -4 (before change)/Position 1-4(after change)
b.Pos_22 To Pos_23 (before change)/Pos_22 To Pos_23 (after change)
c.Pos_30 To Pos_31 (before change)/Pos_30 To Pos_31 (after change)
d.Pos_48 To Pos_50 (before change)/Pos_48 To Pos_50(after change)
Joined: 15 Aug 2015 Posts: 1222 Location: Bamberg, Germany
1) Add an INCLUDE=(23,3,BI,EQ,X'22003A') to OUTPUT2 section to filter for changed entries only.
2) Use BUILD as shown in sample, add the missing fields by yourself and learn
3) Look up p,m,HEX in the Manual
One question .Above code helped me in bringing up the current date by using Today .I would like use Today-1 (previous day's date )?How could i achieve it in the same above JCL .
For eg : If batch run date is 09 November 2020 ,then the instead of today i should be getting 08 november 2020 .(previous date instead of current date)