Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Formatting bit fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Formatting bit fields
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: 1331
Location: Israel

PostPosted: Thu Sep 19, 2019 7:54 pm    Post subject: Reply to: Formatting bit fields
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

Senior Member


Joined: 21 Sep 2010
Posts: 2310
Location: NY,USA

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

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

Senior Member


Joined: 14 Mar 2007
Posts: 10639
Location: italy

PostPosted: Thu Sep 19, 2019 8:51 pm    Post subject: Reply to: Formatting bit fields
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

https://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
https://www.ibm.com/support/pages/beyond-sorting-paper-sortbynd

Smart DFSORT Tricks
https://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    Post subject: Re: Reply to: Formatting bit fields
Reply with quote

enrico-sorichetti wrote:

see here for some hints

https://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: 1331
Location: Israel

PostPosted: Sun Sep 22, 2019 12:30 pm    Post subject: Re: Formatting bit fields
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

New User


Joined: 15 Aug 2015
Posts: 61
Location: Germany

PostPosted: Mon Sep 23, 2019 11:40 pm    Post subject:
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    Post subject: Re: Formatting bit fields
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: 1331
Location: Israel

PostPosted: Tue Sep 24, 2019 2:39 pm    Post subject:
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

New User


Joined: 15 Aug 2015
Posts: 61
Location: Germany

PostPosted: Tue Sep 24, 2019 4:36 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Training on numeric fields data formats sergeyken SYNCSORT 12 Thu Aug 01, 2019 8:15 pm
No new posts Need to get the SUM of two fields usi... Poha Eater DFSORT/ICETOOL 7 Tue Jun 18, 2019 1:27 pm
No new posts Compare fields with decimal chandan.inst SYNCSORT 6 Thu Apr 04, 2019 5:29 pm
No new posts Query on summing up the fields abdulrafi DFSORT/ICETOOL 10 Mon Jan 21, 2019 7:18 pm
No new posts Convert VB file to FB plus special fo... cz016m SYNCSORT 15 Fri Oct 19, 2018 7:26 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us