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

How to read unpacked field created in file by PLI


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

New User


Joined: 08 Nov 2019
Posts: 10
Location: INDIA

PostPosted: Wed Apr 07, 2021 9:01 pm
Reply with quote

I Have report file and it contains unpacked value spanned in 2 records.
e.g decimal 1234 ( in file it is not F1F2F3F4) value is displayed as
FFFF
1234

So my requirement is convert this to unhex value. I can't use TRAN=UNHEX.
Please suggest me any way to read the unpacked value i.e created by PLI UNPACK function.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Apr 07, 2021 9:04 pm
Reply with quote

you mean that the FFFF are in one record, and the 1234 is in the record which comes next ???
( obviously column aligned )
Back to top
View user's profile Send private message
rnimmala

New User


Joined: 08 Nov 2019
Posts: 10
Location: INDIA

PostPosted: Wed Apr 07, 2021 9:10 pm
Reply with quote

yes. Your understanding is correct.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Apr 07, 2021 9:18 pm
Reply with quote

What don't you fix the module that created incorrect report ?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Apr 07, 2021 9:36 pm
Reply with quote

Quote:
What don't you fix the module that created incorrect report ?


IMO the module that created the <report> created what it was supposed to
( some kind of vertical hex dump perhaps )
and nothing wrong with that ( it takes quite a bit of coding to do it by hand )

my wild guess is that it is the output of some utility - could be even a <sort> step

the best thing would be to review the whole approach
Back to top
View user's profile Send private message
rnimmala

New User


Joined: 08 Nov 2019
Posts: 10
Location: INDIA

PostPosted: Wed Apr 07, 2021 9:56 pm
Reply with quote

Hi,
Even I am seeing first time in my 20 years Mainframe career. It is comparison report and convince purpose report displayed fields in vertical hex format.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Apr 07, 2021 10:02 pm
Reply with quote

For example:
Code:
//WHATEVER EXEC PGM=ICEMAN                                             
//SORTIN   DD *                                                       
FFFF                                                                   
1234                                                                   
/*                                                                     
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  OPTION COPY                                                         
  INREC IFTHEN=(WHEN=INIT,                                             
    OVERLAY=(81:SEQNUM,1,ZD,START=2,81:81,1,ZD,MOD,+2,ZD,LENGTH=1)),   
    IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,+0),RECORDS=2,PUSH=(82:1,4)),
    IFTHEN=(WHEN=NONE,                                                 
      PARSE=(%001=(FIXLEN=1,REPEAT=4),                                 
             %101=(ABSPOS=82,FIXLEN=1,REPEAT=4)),                     
      BUILD=(%101,%001,%102,%002,%103,%003,%104,%004,81:81,1))         
  OUTFIL FNAMES=(SORTOUT),                                             
    INCLUDE=(81,1,ZD,EQ,+1),                                           
    BUILD=(1,8,TRAN=UNHEX)                                             
  END                                                                 
/*

Output:
Code:
****** *******************
000001 1234               
****** *******************
Back to top
View user's profile Send private message
rnimmala

New User


Joined: 08 Nov 2019
Posts: 10
Location: INDIA

PostPosted: Wed Apr 07, 2021 10:41 pm
Reply with quote

Thank you.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Thu Apr 08, 2021 2:30 am
Reply with quote

Simple solution for simple task:
Code:
 SORT FIELDS=COPY,SKIPREC=1,STOPAFT=1
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Thu Apr 08, 2021 10:02 am
Reply with quote

sergeyken wrote:
Simple solution for simple task:
Code:
 SORT FIELDS=COPY,SKIPREC=1,STOPAFT=1

What if you have more lines to decode, or not just digits? It will simply return incomplete or false results for such cases. icon_exclaim.gif


Multiline Digits only:
Code:
//WHATEVER EXEC PGM=ICEMAN
//SORTIN   DD *           
FFFFFFFFFF               
1234567890               
FFFFFFFFFF               
0987654321               
/*                       
//SYSOUT   DD SYSOUT=*   
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *           
  OPTION COPY,SKIPREC=1   
  OUTFIL SAMPLE=2         
  END                     
/*
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Apr 08, 2021 2:45 pm
Reply with quote

Or just include NUM
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Thu Apr 08, 2021 5:29 pm
Reply with quote

Joerg.Findeisen wrote:
sergeyken wrote:
Simple solution for simple task:
Code:
 SORT FIELDS=COPY,SKIPREC=1,STOPAFT=1

What if you have more lines to decode, or not just digits? It will simply return incomplete or false results for such cases.

There was no request for something else:
Quote:
I Have report file and it contains unpacked value spanned in 2 records.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Thu Apr 22, 2021 6:38 pm
Reply with quote

Just wanted to add this here for interested parties.
Code:
//TRANHEXU EXEC PGM=ICEMAN
//SORTIN   DD *                                                         
4444444444444444444444444444C988984E89998                               
00000000000000000000000000003649570214735                               
44444444444444444444444444444444A88A                                   
000000000000000000000000000000003813                                   
4444444444444444444444A999A4A884A8A48A4A89A984884444444444444444       
0000000000000000000000669220385061809302864340250000000000000000       
/*                                                                     
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  OPTION COPY                                                           
  INREC IFTHEN=(WHEN=INIT,                                             
    OVERLAY=(161:SEQNUM,1,ZD,START=2,161:161,1,ZD,MOD,+2,ZD,LENGTH=1)),
    IFTHEN=(WHEN=GROUP,                                                 
      BEGIN=(161,1,ZD,EQ,+0),RECORDS=2,PUSH=(81:1,80)),                 
    IFTHEN=(WHEN=(161,1,ZD,EQ,+1),                                     
      FINDREP=(INOUT=(C' ',C'4'),STARTPOS=81,ENDPOS=160),HIT=NEXT),     
    IFTHEN=(WHEN=(161,1,ZD,EQ,+1),                                     
      FINDREP=(INOUT=(C' ',C'0'),STARTPOS=1,ENDPOS=80),HIT=NEXT),       
    IFTHEN=(WHEN=ANY,                                                   
      PARSE=(%001=(FIXLEN=1,REPEAT=80),                                 
             %101=(FIXLEN=1,REPEAT=80)),                               
      BUILD=(%101,%001,%102,%002,%103,%003,%104,%004,                   
             %105,%005,%106,%006,%107,%007,%108,%008,                   
             %109,%009,%110,%010,%111,%011,%112,%012,                   
             %113,%013,%114,%014,%115,%015,%116,%016,                   
             %117,%017,%118,%018,%119,%019,%120,%020,                   
             %121,%021,%122,%022,%123,%023,%124,%024,                   
             %125,%025,%126,%026,%127,%027,%128,%028,                   
             %129,%029,%130,%030,%131,%031,%132,%032,                   
             %133,%033,%134,%034,%135,%035,%136,%036,                   
             %137,%037,%138,%038,%139,%039,%140,%040,                   
             %141,%041,%142,%042,%143,%043,%144,%044,                   
             %145,%045,%146,%046,%147,%047,%148,%048,                   
             %149,%049,%150,%050,%151,%051,%152,%052,                   
             %153,%053,%154,%054,%155,%055,%156,%056,           
             %157,%057,%158,%058,%159,%059,%160,%060,           
             %161,%061,%162,%062,%163,%063,%164,%064,           
             %165,%065,%166,%066,%167,%067,%168,%068,           
             %169,%069,%170,%070,%171,%071,%172,%072,           
             %173,%073,%174,%074,%175,%075,%176,%076,           
             %177,%077,%178,%078,%179,%079,%180,%080,161:161,1))
  OUTFIL FNAMES=(SORTOUT),                                       
    INCLUDE=(161,1,ZD,EQ,+1),                                   
    REMOVECC,                                                   
    BUILD=(1,160,TRAN=UNHEX)                                     
  END                                                           
/*
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top