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

Formatting bit fields


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

New User


Joined: 19 Sep 2019
Posts: 3
Location: United Kingdom

PostPosted: Thu Sep 19, 2019 6:14 pm
Reply with quote

We're currently using ICETOOL/DFSORT to format a bunch of fields in a data dump. One of the fullwords that we currently decode using:

57:63,4,HEX,

is, in reality, actually a collection of bits that I'd rather decode bit-by-bit into some meaningful character to represent its function if set, or a dot (or lower case character, maybe) if not set.

Is such a decoding easily possible in dfsort, or should I be looking at doing this in Rexx?

Any pointers to where in the rather extensive documentation I might start with this would be much appreciated.

Thanks,

Ian
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Sep 19, 2019 7:54 pm
Reply with quote

358.gif to the forum

Try:
Code:
57:63,4,TRAN=BIT,
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Thu Sep 19, 2019 8:33 pm
Reply with quote

ibmmainframes.com/viewtopic.php?t=67267&highlight=
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Sep 19, 2019 8:51 pm
Reply with quote

unfortunatley the link provided is pretty useless , deals only with hex chars, not single bits

welcome Ian

see here for some hints

www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.icea100/ice2ca_Method_1__Bit_operator_tests.htm


some additional papers on DFSORT, old but still useful


DFSORT: Beyond Sorting
www.ibm.com/support/pages/beyond-sorting-paper-sortbynd

Smart DFSORT Tricks
www.ibm.com/support/pages/smart-dfsort-tricks
Back to top
View user's profile Send private message
IanWorthington

New User


Joined: 19 Sep 2019
Posts: 3
Location: United Kingdom

PostPosted: Fri Sep 20, 2019 3:14 pm
Reply with quote

enrico-sorichetti wrote:

see here for some hints

www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.icea100/ice2ca_Method_1__Bit_operator_tests.htm


Thanks Enrico

This looks promising, but seems to deal only options on the INCLUDE statement, whereas it looks like I need something that works on the BUILD statement, no? Or have I missed something?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Sep 22, 2019 12:30 pm
Reply with quote

IanWorthington wrote:
a collection of bits that I'd rather decode bit-by-bit into some meaningful character to represent its function if set, or a dot (or lower case character, maybe) if not set.

Sorry for misunderstanding the question. Maybe this is closer to what you want:
Code:
//STEP001  EXEC PGM=SORT                                   
//SYSOUT   DD   SYSOUT=*                                   
//SORTIN   DD   DISP=SHR,DSN=HLQ.MY.TEST.DATA.IN           
//SORTOUT  DD   DISP=SHR,DSN=HLQ.MY.TEST.DATA.OUT           
//SYSIN    DD   *                                           
  INREC FIELDS=(1,5,6,1,TRAN=BIT,7,10)                     
  SORT  FIELDS=COPY                                         
  OUTREC BUILD=1,5,C' ',6,1,CHANGE=(1,C'0',C'.',C'1',C'Y'),
                         7,1,CHANGE=(1,C'0',C'.',C'1',C'Y'),
                         8,1,CHANGE=(1,C'0',C'.',C'1',C'Y'),
                         9,1,CHANGE=(1,C'0',C'.',C'1',C'Y'),
                        10,1,CHANGE=(1,C'0',C'.',C'1',C'Y'),
                        11,1,CHANGE=(1,C'0',C'.',C'1',C'Y'),
                        12,1,CHANGE=(1,C'0',C'.',C'1',C'Y'),
                        13,1,CHANGE=(1,C'0',C'.',C'1',C'Y'),
                14,10)                                       
//*

with the input:
Code:
LINE 5 FIVE 
LINE 3 THREE
LINE 1 ONE   
LINE 2 TWO   
LINE 4 FOUR 
I get the following output:
Code:
LINE YYYY.Y.Y FIVE 
LINE YYYY..YY THREE
LINE YYYY...Y ONE   
LINE YYYY..Y. TWO   
LINE YYYY.Y.. FOUR 
Of course, a lots of bits will require a whole lot of CHANGE cards ):
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 Sep 23, 2019 11:40 pm
Reply with quote

Use possibilities provided

Code:

//WHATEVER EXEC PGM=ICEMAN                                     
//SYSOUT  DD SYSOUT=*                                         
//SORTIN  DD *                                                 
LINE 99 Ninetynine                                             
LINE 05 FIVE                                                   
LINE 03 THREE                                                 
LINE 01 ONE                                                   
LINE 02 TWO                                                   
LINE 04 FOUR                                                   
/*                                                             
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,5,6:6,2,ZD,TO=BI,LENGTH=2))
  SORT FIELDS=(COPY)                                           
  OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,5,X,6,2,TRAN=BIT)),       
    IFTHEN=(WHEN=INIT,                                         
      FINDREP=(INOUT=(C'0',C'.',C'1',C'Y'),STARTPOS=7,DO=16)) 
  END                                                         
/*                                                             


gives

Code:

LINE  .........YY...YY   
LINE  .............Y.Y   
LINE  ..............YY   
LINE  ...............Y   
LINE  ..............Y.   
LINE  .............Y..   
Back to top
View user's profile Send private message
IanWorthington

New User


Joined: 19 Sep 2019
Posts: 3
Location: United Kingdom

PostPosted: Tue Sep 24, 2019 11:52 am
Reply with quote

Marso wrote:
...


Hi Marso --

That was /exactly/ what I was after, many thanks for that. A whole lot of CHANGE cards were indeed required, but that was fine: I wanted to choose the symbol for each bit independently.

Again, many thanks.

i
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Sep 24, 2019 2:39 pm
Reply with quote

Joerg.Findeisen wrote:
Use possibilities provided

Code:
//SYSIN    DD *                                               
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,5,6:6,2,ZD,TO=BI,LENGTH=2))
  SORT FIELDS=(COPY)                                           
  OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,5,X,6,2,TRAN=BIT)),       
    IFTHEN=(WHEN=INIT,                                         
      FINDREP=(INOUT=(C'0',C'.',C'1',C'Y'),STARTPOS=7,DO=16)) 
  END                                                         
/*                                                             
That is better than my proposed solution if all bits are '.' or 'Y'.
Mine offers other possibilities like:
Code:
                         7,1,CHANGE=(4,C'0',C'CLO ',C'1',C'OPE '),
                         8,1,CHANGE=(4,C'0',C'DIS ',C'1',C'ENA '),
so it will mostly depends on what the data represents
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue Sep 24, 2019 4:36 pm
Reply with quote

@Marso: That is correct. As your sample had the 1:1 translation functionality implemented, I used that to simplify. If one wants a more readable form your suggestion would be the right way to go.
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 Need help on formatting a report DFSORT/ICETOOL 14
No new posts Rexx formatting CLIST & REXX 2
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Converting unpacked fields to pack us... SYNCSORT 4
Search our Forums:

Back to Top