IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Hex Value - vb file replace old date with current date


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
premnath

New User


Joined: 08 Jan 2006
Posts: 15

PostPosted: Sat Oct 17, 2020 3:15 am
Reply with quote

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)

Output file 2 format:(8 COLUMNS)
Oldvalue New_value Old_value new_value Old_value new_value Old_value new_value




Input file sample:
Code:
Command ===> Scroll ===> CSR
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000008 1537159 t 0 Ç 6lpl Ì 9 &d 0 0 &d ç 0 ã 0 1 0
FFFFFFF000A00F0301203063F999307303F3583F3F358332003133243F32343F3F3F0000
15371590003010080420A68A6373A08A1A9A04A0A0A04AA047A18A08A0A3A6A0A1A00000
------------------------------------------------------------------------------
000009 1537159 t 0 qËáÈ 4Á àr 4 3 0
FFFFFFF000A00F0100203000000974703F63493F3F3F2244444444444444444444444444
153715900030200C0726A00000583544A45A49A4A3A02C00000000000000000000000000
------------------------------------------------------------------------------
000010 1537159 t 0 /  0 0 0
FFFFFFF000A00F010020333006643F3F3F33003333322444444444444444444444444444
153715900030300B0D29A2A02121A0A0A0AA00AAAAA2C000000000000000000000000000
------------------------------------------------------------------------------


I had tried when and overlay options which didnt work as iam new to dfsort.could some one help with a solution please
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1222
Location: Bamberg, Germany

PostPosted: Sat Oct 17, 2020 3:54 am
Reply with quote

Something like this should do:

Code:
//WHATEVER EXEC PGM=ICEMAN                           
//SYMNAMES DD *,SYMBOLS=EXECSYS                                   
Today,X'&LYR2.&LMON.&LDAY'                                         
/*                                                                 
//SYMNOUT  DD SYSOUT=*                                             
//SORTIN   DD DISP=SHR,DSN=&SYSUID..TEST                           
//SYSOUT   DD SYSOUT=*                                             
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=(23,3,BI,EQ,X'22003A',AND,52,3,BI,LT,Today), 
    OVERLAY=(52:Today,26:X'0087',34:SEQNUM,2,BI))                 
  END                                                             
/*


You need to decide how to proceed w/ short length records.
Back to top
View user's profile Send private message
premnath

New User


Joined: 08 Jan 2006
Posts: 15

PostPosted: Sat Oct 17, 2020 3:13 pm
Reply with quote

@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.
Code:
//SYMNAMES DD *,SYMBOLS=EXECSYS   
TODAY,X'&LYR2.&LMON.&LDAY'
/*   


Below is what currently i see when i use jjscan .

Code:
//WHATEVER EXEC PGM=ICEMAN   
//SYMNAMES DD *,SYMBOLS=EXECSYS   
//SYMNAMES DD *,SYMBOLS=EXECSYS   
CAY6037E UNKNOWN KEYWORD "SYMBOLS" SPECIFIED IN OPERAND OF "DD"   
   
TODAY,X'&LYR2.&LMON.&LDAY'   
TODAY,X"&LYR2.&LMON.&LDAY"   
CAY6048E "X"&LYR2.&LMON.&LDAY"" IS ILLEGAL OPERAND FOR "CONSTANT"   
PARAMETER OF "SYMBOL"   
   
/*   
//SYMNOUT DD SYSOUT=*   
//SORTIN DD DISP=SHR,DSN=BSTST.TEST.S1527.OUT2   


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 .
Back to top
View user's profile Send private message
premnath

New User


Joined: 08 Jan 2006
Posts: 15

PostPosted: Sat Oct 17, 2020 4:09 pm
Reply with quote

if i pass static value for the current date without dynamically deciding through batch cycle using below jcl
Code:
//WHATEVER EXEC PGM=ICEMAN   
//SYMNAMES DD *   
TODAY,X'201017'   
/*   
//SYMNOUT DD SYSOUT=*   
//SORTIN DD DISP=SHR,DSN=BSTST.TEST.S1527.OUT2   
//SYSOUT DD SYSOUT=*   
//SORTOUT DD DSN=BSTST.TEST.OUT.FLIP,DISP=SHR   
//SYSIN DD *   
OPTION COPY   
INREC IFTHEN=(WHEN=(23,3,BI,EQ,X'22003A',AND,52,3,BI,LT,TODAY),   
OVERLAY=(52:TODAY,26:X'0087',34:SEQNUM,2,BI))   
END


I get below outputs and results are here
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
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
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1222
Location: Bamberg, Germany

PostPosted: Sat Oct 17, 2020 4:18 pm
Reply with quote

Another one:
Code:
//TODAY    EXEC PGM=ICEMAN                                             
//SORTIN   DD *                                                       
DUMMY                                                                 
/*                                                                     
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD DISP=(NEW,PASS),UNIT=SYSALLDA,SPACE=(TRK,(1,1)),LRECL=80
//SYSIN    DD *                                                       
  OPTION COPY,STOPAFT=1                                               
  INREC OVERLAY=(7:DATE1,1:C'Today,X''',15:C'''',80:X)                 
  END                                                                 
/*                                                                     
//WHATEVER EXEC PGM=ICEMAN                                             
//SYMNAMES DD DISP=(OLD,PASS),DSN=*.TODAY.SORTOUT                     
//SYMNOUT  DD SYSOUT=*                                                 
//SORTIN   DD DISP=SHR,DSN=&SYSUID..TEST                           
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  OPTION COPY
  INREC 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=(SORTOUT),                                             
    REMOVECC                                                           
  END                                                                 
/*
Back to top
View user's profile Send private message
premnath

New User


Joined: 08 Jan 2006
Posts: 15

PostPosted: Sat Oct 17, 2020 5:50 pm
Reply with quote

@Joerg.Findeisen

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
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1222
Location: Bamberg, Germany

PostPosted: Sat Oct 17, 2020 9:25 pm
Reply with quote

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                                                                 
/*
Back to top
View user's profile Send private message
premnath

New User


Joined: 08 Jan 2006
Posts: 15

PostPosted: Sun Oct 18, 2020 2:28 am
Reply with quote

@Joerg.Findeisen

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)

Output file 2 format:(8 COLUMNS)
Oldvalue New_value Old_value new_value Old_value new_value Old_value new_value.

Your help will be much appreciated .
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1222
Location: Bamberg, Germany

PostPosted: Sun Oct 18, 2020 6:02 am
Reply with quote

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
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Sun Oct 18, 2020 6:38 am
Reply with quote

The JJSCAN you used in your original example seems to be too stupid, or obsolete (though I’ve never used it myself).

You need to verify: does your JES support JCL statement EXPORT, and DD parameter SYMBOLS? Do not try to use untrusted JJSCAN for that purpose.

If it doesn’t, then Joerg suggested you a workaround solution, using SORT utility’s ability to get the date value dynamically, instead of JCL.
Back to top
View user's profile Send private message
premnath

New User


Joined: 08 Jan 2006
Posts: 15

PostPosted: Mon Oct 19, 2020 11:42 pm
Reply with quote

Thanks a ton ! Below is the code i tried for build and it worked fine
Code:
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)      
OUTFIL FNAMES=(OUTPUT2),      
REMOVECC,VLTRIM=C' ',      
HEADER1=(1:C'NEW-STORE OLD-STORE NEW-REGNO OLD-REGNO NEW-TNO   ',   
49:C'OLD-TNO NEW-DT OLD-DT'),      
INCLUDE=(23,3,BI,EQ,X'22003A'),      
BUILD=(1,4,5,4,6X,601,4,6X,26,2,HEX,6X,622,2,HEX,6X,      
34,2,HEX,6X,630,2,HEX,2X,      
52,3,HEX,1X,648,3,HEX)      
END      
/*   


Output

Code:
1537   1537   0087   0668   0001   0078   201019   200407   
1537   1537   0087   0668   0002   0079   201019   200407   
1537   1537   0087   0668   0003   0080   201019   200407   


Thank you again .Learning new things in this forum .special thanks to Joerg.Findeisen.He always rocks
Back to top
View user's profile Send private message
premnath

New User


Joined: 08 Jan 2006
Posts: 15

PostPosted: Mon Nov 09, 2020 9:00 pm
Reply with quote

Hi Joerg.Findeisen,

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)
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1222
Location: Bamberg, Germany

PostPosted: Mon Nov 09, 2020 9:12 pm
Reply with quote

This is so simple that you could have figured that by yourself.

Code:
//TODAY    EXEC PGM=ICEMAN                                             
//SORTIN   DD *                                                       
DUMMY                                                                 
/*                                                                     
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD DISP=(NEW,PASS),UNIT=SYSALLDA,SPACE=(TRK,(1,1)),LRECL=80
//SYSIN    DD *                                                       
  OPTION COPY,STOPAFT=1                                               
  INREC OVERLAY=(7:DATE1-1,1:C'Today,X''',15:C'''',80:X)                 
  END                                                                 
/*
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Nov 09, 2020 9:13 pm
Reply with quote

What have you tried? Did you try TODAY-1? I would - if I didn't consult the manual first to see if it was, or was not, possible.
Back to top
View user's profile Send private message
premnath

New User


Joined: 08 Jan 2006
Posts: 15

PostPosted: Tue Nov 10, 2020 8:06 am
Reply with quote

Thanks a lot Joerg.Findeisen!.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top